Number of pandiagonal magic squares

The answer to the question of the number of pandiagonal squares is very complicated, as they don't exist for certain orders.

For a long time, they thought that no pandiagonal square, whose order is a multiple of 3, exists, but meanwhile algorithms to construct them are known.

Let's have a closer look to a pandiagonal square of the 5th order. To analyze this square we decrease all values by 1.

  • 182210141
  • 17219130

Now we seem to do it more complex and display all numbers in a number system with radix 5. This isn't a problem anymore, since all numbers are in the range from 0 to 24 and thus are to display with two digits.

For a better oversight we also displayed the numbers in a different way: the second digit values in upper-case, the first digit values in lower-case. Now we can better distinguish their different meanings.

  • 324114230
  • DcEbBeCdAa

A perfect symmetrical arrangement, as in every row and every column, in every diagonal and even in every broken diagonal, every upper-case letter and every lower-case character can be found once. If we replace the letters with the second digit value and the first digit value from the number system with radix 5 and increase every single result by 1, a pandiagonal square must inevitably be the result.

Now let's start to count the number of different squares that can be created with the help of this scheme. At first we can decide if we cover the upper-case letters or the lower-case letters with the first- or second digit value. So we have m1=2 possibilities.

When we decide that the upper-case letters should be covered with the second digit values, we give the cells with the numbers 0, 1, 2, …, n−1 the values 0, 5, 10, … , 5(n−1) zu. This means that there are 5 possibilities for the letter A. After choosing A, four possibilities remain for the letter B, three for C etc. This results in m2=120 possibilities for the allocation of the upper-case letters.

m2=5 · 4 · 3 · 2 · 1=5!=120

The lower-case letters must be set to te values 0, 1, 2, … , n−1. Here we also have m3=120 possibilities.

m3=5 · 4 · 3 · 2 · 1=5!=120

So we have 28 800 pandiagonal squares of 5th order that can be generated with this algorithm.

m=m1 · m2 · m3
=2! · 5! · 5!
=2 · 120 · 120
=28 880

From the mentioned symmetry we can conclude that other sqares can't exist. Indeed they all are of course not different, as they partly can be generated by rotating and reflecting each other. Inquests have resulted in the fact that altogether 3600 different pandiagonal squares exist.

If we understand the relationship between two pandiagonal squares very closely, we have to slightly change the results. Pandiagonal squares can't only be generated by rotating and reflecting each other, but also by relocating. Because of the perfect symmetry also along the broken diagonal we can move it horizontally and vertically, if we interpret the new position as usual modulo of the order. The number of pandiagonal squares where also those squares generated by relocation are seen as equivalent, be P'(n).

If we allow those relationships, only P'(4)=3 different pandiagonal squares of 4th order exist. With their 16 cells this means that we can move any cell to 16 target positions, so we have 16 different relocations. Four rotations and two diagonal reflections result in this number of possibilities:

m=3 · 16 · 8=384

Now all questions up to the 6th order are extensively answered. From the 7th order no exact results are known. The given numbers are rough guesses.

Ordnung N(n) P(n) P'(n)
2 0 0 0
3 0 0 0
4 384 48 3
5 28800 3600 144
6 0 0 0
7 ? 38 Mill. ?
8 ? 6,5 Bill. ?