ROSECODE 247
Polyominoes 1
A polyomino is a geometric figure obtained by joining equal squares edge by edge.
We consider that one side of each square is painted: when comparing two polyominoes for symetry, the painted sides must always stay up.
Two polyominoes are equal if they differ only by a rotation of a multiple of
To sort the polyominoes, we define the "canonical value" of a polyomino as follow:
It can be represented either by
or by
The first representation yields the values = 46
The second representation yields the values = 232
Thus, the canonical value for this polyomino is 46.
With 4 squares, there are 7 possible polyominoes (sorted by their canonical values):
How many polyominoes with 8 squares are there?
What is the canonical value of the 666-th poylyomino?
Format answer: Count,Value
[My timing: 40 sec]
We consider that one side of each square is painted: when comparing two polyominoes for symetry, the painted sides must always stay up.
Two polyominoes are equal if they differ only by a rotation of a multiple of
To sort the polyominoes, we define the "canonical value" of a polyomino as follow:
- A polyomino is represented by a matrix of 0 and 1
- We consider all 4 rotations and keep those where the matrix is such as the number of rows is
the number of columns. - We add a column of 0 at the end, flatten the values and consider them as a binary representation of some integer. The canonical value is the smallest of these integers.
The first representation yields the values
The second representation yields the values
Thus, the canonical value for this polyomino is 46.
With 4 squares, there are 7 possible polyominoes (sorted by their canonical values):
-
30
-
46
-
54
-
78
-
108
-
142
-
198
How many polyominoes with 8 squares are there?
What is the canonical value of the 666-th poylyomino?
Format answer: Count,Value
[My timing: 40 sec]