In how many ways one can color the cells of a table, each with one of four colors, such that no cells that share a side have the same color and all four colors appear in every square formed by neighboring cells?
Solution
Answer: .
Suppose there are at least three different colors in the first row. Then they occur consecutively, say in the order . Then the cell below the has the fourth color , and all other cells are determined by the first row, because three cells in a square determine the other one, and we can fill the board from right to left and left to right, beginning at the . Notice that the cells below are , so the next row always has three different colors and can be filled. Finally, notice that the colors alternate in the columns in between and , so all columns have two different colors. There are ways to choose the two colors for the top two cells in the first column and ways to choose the two colors for the top two cells in each next column: if we chose for the first column, then we can choose or for the first column, or for the next column, or for the next column, and so on. We only need to exclude the cases where there are only two colors in the first row: in this case, we still have 6 choices for the first column, and 2 choices for each of the first two columns orders. The other orders are determined to be the same as the preceding ones, so to repeat the pattern. So we must exclude cases.
Now we deal with the case in which there are only two colors in the first row. There are ways to choose the colors in the first row. Then each following row has the other two colors, alternated in one of two ways. So in this case we have colorings.
So the grand total is .