# Counting magic squares

Although many problems concerning magic squares have long been solved, there are still some open questions, for example the number of magic squares of sixth or higher order is not known.

Let us take a closer look. There is just one magic square of third order, although it can occur in eight different forms by reflections and rotations. On the other hand, already 880 magic squares of fourth order exist, which may be presented by reflections and rotations in 7040 various forms.

With 5th order, it becomes really complicated. Let's take a deeper look at the following magic square, which was constructed by the method of de la Loubère. For further processing, we reduce all numbers by one.

•  17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9
•  16 23 0 7 14 22 4 6 13 15 3 5 12 19 21 9 11 18 20 2 10 17 24 1 8

Now we seem to do it in a more complex way 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 can be written with two digits.

For a better oversight we also displayed the numbers in a different way: the left digit in uppercase as capital letters and the right digit in lowercase. Now we can better distinguish their different meanings.

•  31 43 0 12 24 42 4 11 23 30 3 10 22 34 41 14 21 33 40 2 20 32 44 1 13
•  Db Ed Aa Bc Ce Ec Ae Bb Cd Da Ad Ba Cc De Eb Be Cb Dd Ea Ac Ca Dc Ee Ab Bd

We have received our magic square substituting the letters with the following numbers, where, of course, all numbers have to be increased additionally by one.

A B C D E a b c d e
0 5 10 15 20 0 1 2 3 4

But this is only one possible substitution, because the magical property does not depend on specific numerical values, but on the existing symmetric arrangement of uppercase and lowercase letters. Let us be clear, what different choices could be made.

• The lowercase letters can be assigned by any digit in a number system with radix 5. So we have a total of 5 possibilities for such a choice of 'a'. If 'a' is chosen, four possibilities remain for the choice of 'b', three for 'c' and so on. Overall there are m1=120 possibilities for the assignment of lowercase letters.

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

• The capital letters correspond to the upper values 0, 5, 10, … , 5(n-1) in such a radix 5 system. But as 'C' occurs five times on the main diagonal, it can not be chosen freely, but must be assigned with the average value C=10 of all numbers. All other letters can be chosen arbitrarily because of the symmetrical arrangement. This means that four possibilities exist for 'A', three for 'b' etc. Altogether there are m2=24 possibilities for capital letters.

m2=4 · 3 · 2 · 1=4!=24

Overall, this results in 2 880 different magic squares for this method.

m= m1 · m2= 120 · 24=2880

On closer examination however, it is found that only 720 of these 2880 magic squares are really different. All other magic squares can be generated by rotations and reflections from these basic squares.

Bachet presented annother algorithm that creates 720 different magic squares. And other generalizations of the method of Loubère can also create different squares. So you can imagine the difficulties to guess the exact number of magic square of any order.