Let $m,n$ be positive integers. An $n\times n$ board has rows and columns numbered $1,2,\dots,n$ from left to right and top to bottom, respectively. This board is colored with colors $r_1,r_2,\dots,r_m$ such that the cell at the intersection of $i$th row and $j$th column is colored with $r_{i+j-1}$ where indices are taken modulo $m$. After the board is colored, Ahmet wants to put $n$ stones to the board so that each row and column has exactly one stone, also he wants to put the same amount of stones to each color. Find all pairs $(m,n)$ for which he can accomplish his goal. Proposed by Sena Başaran
Problem
Source: Turkey Olympic Revenge 2024 P1
Tags: combinatorics
06.08.2024 17:24
Since it does not matter, let's say we number the rows and columns from $0$ to $n-1$ and color $(i,j)$ with the color $r_{i+j}\pmod m$. Also, we think of sets as multisets where multiple items of the same value can occur but the order is not important. And when we say "$k$ times a set $S$", we mean the multiset where each element of $S$ is added $k$ times. Claim 1. $m\mid n$ Proof. We put the same number of stones to each color, say $k$, so we have $km$ stones which is equal to $n$ because every row has exactly one stone. Claim 2. Putting stones to $(0,0),(1,1),\cdots,(n-1,n-1)$ works for odd $n$. It also works if $n$ is even and $m$ is odd. Proof. We need to show that $\{0,2,4,\cdots,2n-2\}\equiv$ $k$ times $\{0,1,2,\cdots,m\}\pmod m$. If $n$ is odd, then $\{0,2,4,\cdots,2n-2\}\equiv\{0,1,2,\cdots,n-1\}\pmod n$ (because $2x\equiv 2y$ means $x\equiv y$) and clearly $\{0,1,2,\cdots,n-1\}\equiv$ $k$ times $\{0,1,2,\cdots,m\}\pmod n$. If $n$ is even and $m$ is odd, then $\{0,2,4,\cdots,2n-2\}\equiv$ $k$ times $\{0,2,4,\cdots,2m-2\}\pmod m$ and since $m$ is odd, $\{0,2,4,\cdots,2m-2\}\equiv \{0,1,2,\cdots,m-1\}\pmod m$ Claim 3. If $n,m,k$ are even ($mk=n$), then $(0,0),(1,1),(2,2),\cdots,(\frac{n}{2}-1,\frac{n}{2}-1),(\frac{n}{2}, \frac{n}{2}+1),(\frac{n}{2}+1,\frac{n}{2}+2),\cdots,(n-1,n),(n,\frac{n}{2})$ works. Proof. We have $\{0,2,4,\cdots,2n-2\}\equiv$ $k$ times $\{0,2,4,\cdots,2m-2\}\pmod m$ and we turn half of ($k$ is even so we can do that) the sets $\{0,2,4,\cdots,2m-2\}$ into $\{1,3,5,\cdots,2m-1\}$ by adding 1 to one of the coordinates. Then we have $\frac{k}{2}$ times $\{0,1,2,\cdots,2m-1\}\pmod m$ which is actually the what we want, $k$ times $\{0,1,2,\cdots,m-1\}\pmod m$. Claim 4. If $n$ and $m$ are even and $k$ is odd, then we can not do that. Proof. Let's say we place stones to $(x_1,y_1),\cdots,(x_n,y_n)$. Then, $\sum_{i=1}^nx_i+y_i=\sum_{i=1}^nx_i+\sum_{i=1}^ny_i$ must be equal to $\sum_{i=1}^mc_i\cdot k\pmod m$ by double counting. That means, $k\cdot(0+1+2+\cdots+m-1)\equiv 2\cdot(0+1+2+\cdots+n-1)\pmod m$. $$\frac{k(m-1)m}{2}\equiv n(n-1) \pmod m$$Let $m=2u$, $k=2v+1$, we get $u\equiv 0\pmod{m=2u}$ which is a contradiction. In conclusion, we can do that if $m\mid n$ and either of the following holds - $n$ is odd - $n$ is even, $m$ is odd - $n$ is even, $m$ is even, $k=\frac{n}{m}$ is even and can not do in other cases.