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

- Pandiagonal magic squares of the 3rd order do not exist.
- Pandiagonal magic squares of the order n=4k + 2 (n=6, 10, …) do not exist.

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.

18 | 22 | 10 | 14 | 1 |

9 | 11 | 3 | 17 | 25 |

2 | 20 | 24 | 6 | 13 |

21 | 8 | 12 | 5 | 19 |

15 | 4 | 16 | 23 | 7 |

17 | 21 | 9 | 13 | 0 |

8 | 10 | 2 | 16 | 24 |

1 | 19 | 23 | 5 | 12 |

20 | 7 | 11 | 4 | 18 |

14 | 3 | 15 | 22 | 6 |

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.

32 | 41 | 14 | 23 | 0 |

13 | 20 | 2 | 31 | 44 |

1 | 34 | 43 | 10 | 22 |

40 | 12 | 21 | 4 | 33 |

24 | 3 | 30 | 42 | 11 |

Dc | Eb | Be | Cd | Aa |

Bd | Ca | Ac | Db | Ee |

Ab | De | Ed | Ba | Ca |

Ea | Bc | Cb | Ae | Dd |

Ce | Ad | Da | Ec | Bb |

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 m_{1}=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 m_{2}=120 possibilities for the allocation of the upper-case letters.

m_{2}=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 m_{3}=120 possibilities.

m_{3}=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 | = | m_{1} · m_{2} · m_{3} |

= | 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.

Order | 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. | ? |