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   17 753 889 197 660 635 632   0   0   0  
7 4.2848 (17) ·1038   3.79809 (50) ·1034   1 125 154 039 419 854 784   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
    All exact numbers are published in Neil Sloane's On-Line Encyclopedia of Integer Sequences ®. (External links)
    OEIS:     (A) A271103 ,     (B) A006052 ,     (C) A081262 ,     (D) A027567 ,     (E) A081263

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 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.
In May 2024 Hidetoshi Mino could confirm A6.
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 (NEW) was calculated during more than one year and finally presented in May 2024 by Hidetoshi Mino (Japan). See (external link).
The first attempt was finished in July 2023. This enumeration made use of about 80,000 hours of Nvidia GeForce RTX-4090 GPUs and used about six months of calendar time.
Unfortunately a few hardware errors happened. It took several months to do the calculation again and correct the errors.
Hidetoshi's method first searches semi-magic order-6 squares and then checks how many magic squares can be derived. In the second attempt also the semi-magic squares were counted. In this way A6 could be confirmed.
The result is consistent with stochastic estimates previously done by Klaus Pinn and Christian Wieczerkowski (May 1998) and by me (March 2002), see magic 6x6-squares.
We can be very sure that B6 was finally enumerated correctly.
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
C7 was calculated by Go Kato (Japan) and first published in November 2018 at OEIS A081262 (external link). His approach is based on Ripatti's method. A short description can be found on OEIS. Read about all details in a paper written by Go Kato and Shin-ichi Minato at (external link). Kato's approach is definitely correct. There is no error in his calculation as I found exactly the same result with an own program based on his method. This new milestone also is a confirmation of my approximation method because Kato's result is very close to the estimate 1.125151(51)·1018 which was shown in the table before.
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.

Walter Trump, Nürnberg, Germany, ms(at), © 2001-11-01 (last modified: 2024-06-03)