Consider the following order-7 magic square.
Row[Text@Style[Grid[#, Frame -> All], 30] & /@
With[{seq = Table[
RotateLeft[Mod[Range[0, 6] + 1, 7], Mod[2 n, 7]], {n, 0, 6}]}, {50 - (Transpose[seq] +
7 RotateRight[Reverse[Mod[seq + 5, 7]]] + 1), Partition[Range[49], 7]}], Spacer[20]]
The rows, columns, and diagonals all add up to the same sum: 175. Also, all the broken diagonals add up to the same sum, making this a pandiagonal magic square. The square is like a torus β by shifting rows or columns to the other edge, any square can be put at the center.
Pick a number from the magic square, then shift about both squares so that your chosen number is at the center. Place a queen at the center of each square. Each queen will then cover one number, the same number, and attack 24 other numbers. Neither queen will attack the same number, and every number gets attacked on exactly one of the two squares! The magic square is pandiagonal
In combinatorics, this is known as the 2-(49,7,1) design. With 49 elements, in blocks of 7, any 2 items can be found in exactly 1 of the blocks. Each of the two squares represents 7 rows, 7 columns, 7 left diagonals, 7 right diagonals, or 28 blocks in each square. So 56 blocks in total. This is also known as the Paley-49 graph. A similar trick can be done with 4x4 magic squares.
