# The Nimm0 Property

In the 17th century the French mathematician Bernard Frénicle de Bessy described all 880 possible order-4 magic squares — that is, all the ways in which the numbers 1 to 16 can be arranged in a 4 × 4 array so that the long diagonals and all the rows and columns have the same sum.

These squares share a curious property: If we subtract 1 from each cell, to get a square of the numbers 0-15, then each of the rows and columns has a nim sum of 0. A nim sum is a binary sum in which 1 + 1 is evaluated as 0 rather than “0, carry 1.” For example, here’s one of Frénicle’s squares: $\displaystyle \begin{matrix} 0 & 5 & 10 & 15\\ 14 & 11 & 4 & 1\\ 13 & 8 & 7 & 2\\ 3 & 6 & 9 & 12 \end{matrix}$

Translating each of these numbers into binary we get $\displaystyle \begin{bmatrix} 0000 & 0101 & 1010 & 1111\\ 1110 & 1011 & 0100 & 0001\\ 1101 & 1000 & 0111 & 0010\\ 0011 & 0110 & 1001 & 1100 \end{bmatrix}$

And the binary sums of the four rows, evaluated without carry, are

0000 + 0101 + 1010 + 1111 = 0000
1110 + 1011 + 0100 + 0001 = 0000
1101 + 1000 + 0111 + 0010 = 0000
0011 + 0110 + 1001 + 1100 = 0000

The same is true of the columns. (The diagonals won’t necessarily sum to zero, but they will equal one another. And note that the property described above won’t necessarily work in a “submagic” square in which the diagonals don’t add to the magic constant … but it does work in all 880 of Frénicle’s “true” 4 × 4 squares.)

(John Conway, Simon Norton, and Alex Ryba, “Frenicle’s 880 Magic Squares,” in Jennifer Beineke and Jason Rosenhouse, eds., The Mathematics of Various Entertaining Subjects, Vol. 2, 2017.)