How many magic squares are there?
Results of historical and computer enumeration

Order semi-magic
(including magic)
(classic magic)


3 9   1   1   0   0  
4 68 688   880   48   48   0  
5 579 043 051 200   275 305 224   48 544   3 600   16  
6 94 590 660 245 399 996 601 600   1.775399 (42) ·1019   0   0   0  
7 4.2848 (17) ·1038   3.79809 (50) ·1034   1.125151 (51) ·1018   1.21 (12) ·1017   20 190 684  
8 1.0806 (12) ·1059   5.2225 (18) ·1054   2.5228 (14) ·1027   C8 + ?   4.677 (17) ·1015  
9 2.9008 (22) ·1084   7.8448 (38) ·1079   7.28 (15) ·1040   81·E9 + ?   1.363 (21) ·1024  
10 1.4626 (16) ·10115   2.4149 (12) ·10110   0   0   0  

Variants of a square by means of rotations and reflections are not counted.
Statistical notation: 1.2345 (25) ·109 means that the number is not known precisely but is in the interval (1.2345 ±0.0025) ·109 with a probability of 99%.
Ultramagic squares are associative (centrally symmetrical) and pandiagonal magic.
  More numbers of classic (normal) magic squares
B3 = 1: the Lo Shu (as it is known) is unique.
B4 was found by the Frenchman Bernard Frénicle de Bessy in 1693. First analytical proof by Kathleen Ollerenshaw and Herman Bondi (1982).
A4, C5 and E5 could be found on the former website of Mutsumi Suzuki.
B5 was calculated in 1973 by Richard Schroeppel (computer program), published in Scientific American in January 1976 in.
A5 was calculated by myself in March 2000 using a common PC. Suzuki published the result on his website. I was able to confirm the result by using other methods.
D5 is equal to the number of regular panmagic squares. They can be generated using Latin squares, as Leonhard Euler pointed out in the 18th century.
A6 (NEW) was calculated by Artem Ripatti (Russia) until April 2018. This is a new milestone in magic square enumeration.
Read his paper at (external link). Download the folder (127 MB) in order to get all data about the number of semi-magic squares over the 9366138 classes.
Artem told me details and results of his calculation already in 2017. I can confirm the correctness of his method.
D6 and D10 were proved by A.H. Frost (1878) and more elegantly by C. Planck (1919).
C6 and C10 are also equal to 0, because each associative (symmetrical) magic square of even order can be transformed into a pandiagonal magic square.
B6 was first estimated (with proper result) by Klaus Pinn and Christian Wieczerkowski and published in May 1998. They used a method called 'parallel tempering Monte Carlo' and got 1.7745(16)·1019
They also estimated B7 with lower accuracy: (3.760 ±0.052)·1034
My own estimates (see table) match these results. I used another method that could be called 'Monte Carlo backtracking'.
All estimates in the columns B, C and D are found with the same method, that is more like the approach of Schroeppel than the one of Pinn and Wieczerkowski. There should be no systematic error, because the method was checked by Prof. Peter Loly (University of Manitoba, Canada) and all results could be confirmed by different programs. For higher orders see: Numbers of classic magic squares
E7 was calculated by myself in May 2001. Special transformations made it possible to consider only two positions of the integers 1, 25 and 49. With advanced equations and a heuristic backtracking algorithm the calculation time could be reduced to a few days. All ultramagic squares of order 7 have been saved and are available for further research. For more details see: Ultramagic Squares of Order 7
D7 (November 2001) was a big surprise. There are 38,102,400 regular pandiagonal magic squares of order 7. Albert L. Candy found 640,120,320 irregular ones. From E7 can be created nearly 1000 million more. But who would have believed that there are more than 1017 such squares? This estimate is very difficult, because the probability is only 1 : 3·1017 that a normal order-7 square is pandiagonal.
D8 is greater than C8 because each associative magic square of order 8 can be transformed into a pandiagonal one and there are examples of additional pandiagonal squares that could not be derived from an associative square.
E8 and E9 were estimated in March 2002. In the case of E8 I could find 64 transformations and several equations with only 4 variables.
D9 is greater than 81·E9, because each ultramagic square of order 9 can be transformed by cyclic permutation of rows and columns into 80 other pandiagonal magic squares that are not associative.

Latest Updates
A6 on 2018-07-17
Walter Trump, Nürnberg, Germany, ms(at), © 2001-11-01 (last modified: 2018-07-17)