Olympiad Maths Prep

Track / Stage 7 / 11 of 300 #1411 of 2000

Problem 1411

National olympiad second round; IMO P1/P4
Combinatorics Difficulty 7.0 Find the answer

Find all positive integers nn for which we can fill in the entries of an n×nn \times n table with the following properties: - each entry can be one of I,MI, M and OO; - in each row and each column, the letters I,MI, M and OO occur the same number of times; and - in any diagonal whose number of entries is a multiple of three, the letters I,MI, M and OO occur the same number of times. Answer. nn can be any multiple of 9.

Official solution

We first show that such a table exists when nn is a multiple of 9. Consider the following 9×99 \times 9 table.
(IIIMMMOOOMMMOOOIIIOOOIIIMMMIIIMMMOOOMMMOOOIIIOOOIIIMMMIIIMMMOOOMMMOOOIIIOOOIIIMMM) \left(\begin{array}{ccccccccc} 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 \end{array}\right)
It is a direct checking that the table (1) satisfies the requirements. For n=9kn=9k where kk is a positive integer, we form an n×nn \times n table using k×kk \times k copies of (1). For each row and each column of the table of size nn, since there are three II's, three MM's and three OO's for any nine consecutive entries, the numbers of I,MI, M and OO are equal. In addition, every diagonal of the large table whose number of entries is divisible by 3 intersects each copy of (1) at a diagonal with number of entries divisible by 3 (possibly zero). Therefore, every such diagonal also contains the same number of I,MI, M and OO.

Next, consider any n×nn \times n table for which the requirements can be met. As the number of entries of each row should be a multiple of 3, we let n=3kn=3k where kk is a positive integer. We divide the whole table into k×kk \times k copies of 3×33 \times 3 blocks. We call the entry at the centre of such a 3×33 \times 3 square a vital entry. We also call any row, column or diagonal that contains at least one vital entry a vital line. We compute the number of pairs (l,c)(l, c) where ll is a vital line and cc is an entry belonging to ll that contains the letter MM. We let this number be NN.

On the one hand, since each vital line contains the same number of I,MI, M and OO, it is obvious that each vital row and each vital column contain kk occurrences of MM. For vital diagonals in either direction, we count there are exactly
1+2++(k1)+k+(k1)++2+1=k2 1+2+\cdots+(k-1)+k+(k-1)+\cdots+2+1=k^{2}
occurrences of MM. Therefore, we have N=4k2N=4k^{2}.

On the other hand, there are 3k23k^{2} occurrences of MM in the whole table. Note that each entry belongs to exactly 1 or 4 vital lines. Therefore, NN must be congruent to 3k2mod33k^{2} \bmod 3.

From the double counting, we get 4k23k2(mod3)4k^{2} \equiv 3k^{2}(\bmod 3), which forces kk to be a multiple of 3. Therefore, nn has to be a multiple of 9 and the proof is complete.

Source: NuminaMath-1.5, licensed Apache-2.0. Statement and solution reproduced as published; topic, difficulty and ordering added by this site.