# Spring 2016, problem 17

Can the numbers from $1$ to $81$ be written on a $9\times9$ board, so that the sum of the numbers in each $3\times3$ square is the same?

### Comments

In the 9x9 grid above, the topmost, rightmost 3x3 does not add up to 369 (it is 387), so this is not a solution.

$c_{0,8}$ should be 35 rather than 53, if you follow the given computation! (There's another 53 in $c_{2,1}$)

Thanks Joost, it was a mistake. (error corrected)

I made my grid with Python (and all the verifications -> LocalAlum1992) but I made a mistake during the transcription.

This can be realized when c≥0 (i.e. a negative-valued vertical asymptote or the y-axis). If c is negative (i.e. a positive-valued vertical asymptote), then we get a discontinuity at x=c and f(x) is negative for x∈(0,c).

For $i, j$ from 0 to 8

${a_{i,j}} = (3i + j)\,\,\bmod \,\,9\,\, + 1$

$\begin{array}{*{20}{c}}1&2&3&4&5&6&7&8&9\\4&5&6&7&8&9&1&2&3\\7&8&9&1&2&3&4&5&6\\1&2&3&4&5&6&7&8&9\\4&5&6&7&8&9&1&2&3\\7&8&9&1&2&3&4&5&6\\1&2&3&4&5&6&7&8&9\\4&5&6&7&8&9&1&2&3\\7&8&9&1&2&3&4&5&6\end{array}$

For $i, j$ from 0 to 8

${b_{i,j}} = (i + 3j)\,\,\bmod \,\,9$

$\begin{array}{*{20}{c}}0&3&6&0&3&6&0&3&6\\1&4&7&1&4&7&1&4&7\\2&5&8&2&5&8&2&5&8\\3&6&0&3&6&0&3&6&0\\4&7&1&4&7&1&4&7&1\\5&8&2&5&8&2&5&8&2\\6&0&3&6&0&3&6&0&3\\7&1&4&7&1&4&7&1&4\\8&2&5&8&2&5&8&2&5\end{array}$

in each 3x3 square ${a_{i,j}}$ take all the values from 1 to 9

in each 3x3 square ${b_{i,j}}$ take all the values from 0 to 8

$(i,j) \to (3i + j,i + 3j)$ is a bijection from $\left( \mathbb{Z} \right.$ / ${\left. {9\mathbb{Z}} \right)^2}$

to $\left( \mathbb{Z} \right.$ / ${\left. {9\mathbb{Z}} \right)^2}$

(determinant 8 = 3x3-1 is relatively prime to 9)

Then ${c_{i,j}} = {a_{i,j}} + 9{b_{i,j}}$ takes all the values from 1 to 81

In each 3x3 square sum of ${c_{i,j}}$ is $369 = 9{\rm{x}}\left( {0 + 1 + ... + 8} \right) + 1 + 2 + ... + 9$

$\begin{array}{*{20}{c}}1&{29}&{57}&4&{32}&{60}&7&{35}&{63}\\{13}&{41}&{69}&{16}&{44}&{72}&{10}&{38}&{66}\\{25}&{53}&{81}&{19}&{47}&{75}&{22}&{50}&{78}\\{28}&{56}&3&{31}&{59}&6&{34}&{62}&9\\{40}&{68}&{15}&{43}&{71}&{18}&{37}&{65}&{12}\\{52}&{80}&{27}&{46}&{74}&{21}&{49}&{77}&{24}\\{55}&2&{30}&{58}&5&{33}&{61}&8&{36}\\{67}&{14}&{42}&{70}&{17}&{45}&{64}&{11}&{39}\\{79}&{26}&{54}&{73}&{20}&{48}&{76}&{23}&{51}\end{array}$

This method works for all integer $n$ (here $n=3$, ${n^2}=9$)

Example: $n = 2,\,\,{n^2} = 4$

$\begin{array}{*{20}{c}}1&{10}&3&{12}\\7&{16}&{5}&{14}\\9&2&{11}&4\\{15}&8&{13}&6\end{array}$