## The number of distinct magic squares, for deceptively small sizes

A magic square of order $n$ is a square grid of $n \times n$ boxes where each box contains one distinct integer from the interval $[1 .. n^2]$, so that the sums of the numbers on each row, on each column and on each of the two diagonals are equal to each other. They have been studied for millenia by mathematicians in China, India and Persia, and continue to be of interest to both hobbyist and professional mathematicians.

The smallest magic squares, excluding the trivial case where $n = 1$, are of order $3$. This is one of them:

\begin{array}{|c|c|c|}
\hline
8 & 3 & 4 \\ \hline
1 & 5 & 9 \\ \hline
6 & 7 & 2 \\ \hline
\end{array}

In a sense, this is the only solution to the problem of this size: the other 7 magic squares of order 3 are mirrored and/or rotated versions of this grid.

We know the number of magic squares of orders 3, 4 and 5. The number of magic squares of order 6 is not known, but is believed to be in the order of $10^{19}$. The number of magic squares is not known for any order greater than 6 either. It should be noted that constructing magic squares of odd and doubly-even (divisible by four) orders is generally regarded as a simpler feat than constructing magic squares of singly-even orders like 6, although this may not guarantee the ease of enumerating all magic squares of such order over enumerating those of orders of smaller singly even numbers.

This problem is trivially solvable if the computational power constraint wouldn't stop us: we could just enumerate all $36!$ possible ways to fit the numbers in the grid, and check each for magic number property. In practice, we can apply a fair bit of pruning to explore only a small fraction of this space. We know the sum that should appear on each row/column/diagonal and we know that only an eighth of the configurations need to be checked to account for their mirrored and/or rotated copies; these and further insights or heuristics may be enough to make the problem computationally tractable for a well-supplied research effort in the coming years.

However, this is in a sense cop-out; even if we solve the number of magic squares of order 6, we'll still be left wondering what the number of magic squares of order 7 and greater might be --- that is, unless someone figures out a more efficient way to compute it than raw enumeration.