Find all positive integers $n$ for which we can fill in the entries of an $n\times n$ table with the following properties:
- Each entry can be one of $I,M,O$;
- In each row and each column, the letters $I,M,O$ occur the same number of times;
- In any diagonal whose number of entries is a multiple of three, the letters $I,M,O$ occur the same number of times.
The following matrix seems to work for $n=9$ :
I I I M M M O O O
M M M O O O I I I
O O O I I I M M M
I I I M M M O O O
M M M O O O I I I
O O O I I I M M M
I I I M M M O O O
M M M O O O I I I
O O O I I I M M M
I also think one can extend this matrix for any n that's a multiple of 9, say $n=9k$, in the natural way. That is, for each of the $k^2$ $9\times 9$ submatrices of the original matrix, fill it with the entries of the given 9 by 9 matrix. However, I'm not sure how to (formally) prove that this construction works. Obviously each entry is one of I,M,O and in each row and column the letters I,M,O occur the same number of times. But how can I prove the last condition is satisfied? Also, I think n must be a multiple of 9.