# Magic squares

## Trivia

• All magic squares of order $4$ is first computed by Frenicle de Bessy in 1693 (E.R.Berlekamp, J.H.Conwayand R.K.Guy, Winning Ways Vol.II, pp778-783).
• All magic squares of order $5$ is first computed by Richard Schroeppel in 1973 (Martin Gardner, Mathematical Games, Scientific American Vol.249 (No.1, January 1976), p118).
• Here is the table of the number of the magic squares of order $n$ excluding rotating and reversing:  $n$ # $1$ $1$ $2$ $0$ $3$ $1$ $4$ $880$ $5$ $275305224$ $\ge{}6$ N/A

## All magic squares of order $3$

• There is only one magic square of order $3$ excluding rotating and reversing.
• Here is the one:  $8$ $1$ $6$ $3$ $5$ $7$ $4$ $9$ $2$

## All magic squares of order $4$

• I made full list of magic squares of order $4$.

## All magic squares of order $5$

• I made full list of magic squares of order $5$. Watch out for the file sizes...

## Magic square files under this directory

Some of these files are missing now!! If you want to get the files, please call me.

 file $n$ origin1 applied my conditions2? applied Rich's conditions3? format ms4.txt $4$ $1$ no no text line ms4.bin $4$ $1$ no no bin ms4.hostbin $4$ $1$ no no 32-bit bin ms4z.txt $4$ $0$ no no text line ms4z.bin $4$ $0$ no no bin ms4z.hostbin $4$ $0$ no no 32-bit bin ms5saf.txt $5$ $1$ yes no text line ms5saf.bin $5$ $1$ yes no bin ms5safo.txt $5$ $1$ no yes text line ms5safo.bin $5$ $1$ no yes bin

1. The smallest number in a square.
2. The condition to avoid rotating and reversing. $a_1 < a_n < a_{n^2-n}$ and $a_1 < a_{n^2}$.
3. The condition to avoid rotating, reversing and exchanging rows/columns.
For $n=5$: $\ a_1 < a_7$, $\ a_1 < a_{19}$, $\ a_1 < a_{25}$, $\ a_1 < a_5$, $\ a_1 < a_{21}$, $\ a_1 < a_9$, $\ a_1 < a_{17}$, $\ a_7 < a_{19}$ and $\ a_5 < a_{21}$ (M. Gardner, 1976).