Suppose you want to distribute nine distinct integers greater than or equal to and less than or equal to into nine square boxes of a grid in such a way that the sums of the numbers on each row and each column are all multiples of . How many possible ways of distributing numbers are there to attain this goal? Regard two configurations, for which one can be obtained from rotating the other one or by flipping over the other one, to be distinct in counting the number of possible ways.
, 2015
Solution
Let us replace every number distributed into a box in the grid by which satisfies the identity . The condition that the sum of the numbers on each row and on each column must be a multiple of does not change after the replacement of the numbers by . Among the triples of integers lying in between (and including) and , only , , and and its permutation of entries are the ones satisfying the requirement that the sum of the entries of the three numbers equals a multiple of . This means that only possible triplets to satisfy the requirement of the problem after the replacement of by are either the ones with all the same entries (such as ) or the ones with all distinct entries (such as ).
If we represent the remainders , , by the letters , , (disregarding the order), we see that each of the letters , , can represent any of the three numbers , , and the only possible placement of these letters that can satisfy the requirements of the problem must be one of the four placements indicated below:



For each of the placements shown above, there are ways of associating kinds of remainder to each of the three letters, and therefore, there are possible ways of getting the distinct configurations after the replacement of numbers by remainders . Furthermore, since there are possible ways of choosing integers for each of the possible remainders , there are ways of inserting integers for each of the possible configurations of the placements of remainders considered above.
Therefore, there are ways of distributing numbers into the boxes of the grid, so as to satisfy the requirement of the problem.