Problem

Source: ELMO Shortlist 2024/C1.5

Tags: Elmo, combinatorics



Let $m, n \ge 2$ be distinct positive integers. In an infinite grid of unit squares, each square is filled with exactly one real number so that In each $m \times m$ square, the sum of the numbers in the $m^2$ cells is equal. In each $n \times n$ square, the sum of the numbers in the $n^2$ cells is equal. There exist two cells in the grid that do not contain the same number. Let $S$ be the set of numbers that appear in at least one square on the grid. Find, in terms of $m$ and $n$, the least possible value of $|S|$. Kiran Reddy