2018-09-30 22:01:58 +00:00
---
id: 5900f40d1000cf542c50ff20
title: 'Problem 161: Triominoes'
2020-11-27 18:02:05 +00:00
challengeType: 5
2019-08-05 16:17:33 +00:00
forumTopicId: 301795
2021-01-13 02:31:00 +00:00
dashedName: problem-161-triominoes
2018-09-30 22:01:58 +00:00
---
2020-11-27 18:02:05 +00:00
# --description--
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
A triomino is a shape consisting of three squares joined via the edges.
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
There are two basic forms:
2018-09-30 22:01:58 +00:00
2021-07-12 14:19:03 +00:00
< img class = "img-responsive center-block" alt = "two basic triominoes forms" src = "https://cdn.freecodecamp.org/curriculum/project-euler/triominoes-1.gif" style = "background-color: white; padding: 10px;" >
2018-09-30 22:01:58 +00:00
If all possible orientations are taken into account there are six:
2021-07-12 14:19:03 +00:00
< img class = "img-responsive center-block" alt = "triominoes forms including orientation" src = "https://cdn.freecodecamp.org/curriculum/project-euler/triominoes-2.gif" style = "background-color: white; padding: 10px;" >
2020-11-27 18:02:05 +00:00
Any n by m grid for which nxm is divisible by 3 can be tiled with triominoes. If we consider tilings that can be obtained by reflection or rotation from another tiling as different there are 41 ways a 2 by 9 grid can be tiled with triominoes:
2018-09-30 22:01:58 +00:00
2021-07-12 14:19:03 +00:00
< img class = "img-responsive center-block" alt = "animation showing 41 ways of filling 2x9 grid with triominoes" src = "https://cdn.freecodecamp.org/curriculum/project-euler/triominoes-3.gif" style = "background-color: white; padding: 10px;" >
2018-09-30 22:01:58 +00:00
In how many ways can a 9 by 12 grid be tiled in this way by triominoes?
2020-11-27 18:02:05 +00:00
# --hints--
2018-09-30 22:01:58 +00:00
2021-07-12 14:19:03 +00:00
`triominoes()` should return `20574308184277972` .
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
```js
2021-07-12 14:19:03 +00:00
assert.strictEqual(triominoes(), 20574308184277972);
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
# --seed--
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
## --seed-contents--
2018-09-30 22:01:58 +00:00
```js
2021-07-12 14:19:03 +00:00
function triominoes() {
2020-09-15 16:57:40 +00:00
2018-09-30 22:01:58 +00:00
return true;
}
2021-07-12 14:19:03 +00:00
triominoes();
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
# --solutions--
2018-09-30 22:01:58 +00:00
```js
// solution required
```