Problem 2
Find all integers for which each cell of an table can be filled with one of the letters , , and in such a way that: in each row and each column, one third of the entries are , one third are , and one third are ; and in any diagonal, if the number of entries on the diagonal is a multiple of three, then one third of the entries on that diagonal are , one third are , and one third are . (Note that an table has diagonals in total, in both directions.)
Step 4 of 5: Count the remaining -cells by rows and columns
In plain words
Rows and columns indexed modulo contribute the complementary count; their overlap is again the good -cells.
Detailed analysis
Let be the -cells in columns , and the -cells in rows . Each selected column and row is balanced, so ; their intersection is the good -cells. Thus . The cells counted in exactly one diagonal family contribute , while the row/column union contributes , so the total number of -cells is .