No three consecutive cells of the same color

171 Views Asked by At

In an $n\times n$ board ($n\geq 3$), how many colors do we need so that we can color the cells such that no three consecutive cells (horizontal, vertical, or diagonal) are of the same color?

With three colors we can do it, using the pattern

$$131$$ $$232$$ $$312$$

and repeating it as necessary. Is it possible with two colors?

2

There are 2 best solutions below

0
On BEST ANSWER

Yes you can:

Take $2$ rows of the form $1; 2; 1; 2 ;1; 2\dots$ and then $2$ rows of the form $2;1;2;1;2;1\dots$.

Repeat this until you've filled all rows

0
On

Yes, think of a chessboard, but then break every third diagonal by shifting each third row over by one. For a 5x5 board this would look like: $$ \begin{matrix} \square & \blacksquare & \square & \blacksquare & \square\\ \blacksquare & \square & \blacksquare & \square & \blacksquare\\ \blacksquare & \square & \blacksquare & \square & \blacksquare\\ \square & \blacksquare & \square & \blacksquare & \square\\ \square & \blacksquare & \square & \blacksquare & \square\\ \end{matrix} $$ This pattern can be extended to all $n$.