Visitar URL original
Prime Magic Square -- from Wolfram MathWorld
TOPICS
Search

Prime Magic Square


A prime magic square is a magic square consisting only of prime numbers (although the number 1 is sometimes allowed in such squares).

PrimeMagicSquareDudeney

The 3×3 prime magic square illustrated above contains a 1 and has the smallest possible magic constant 111 (OEIS A073473) when 1 is allowed. Dudeney (1970) records its discovery in 1900 (Gardner 1984, p. 86).

PrimeMagicSquareOndrejka

The 3×3 magic square illustrated above consists of primes only and has the smallest possible magic constant 177 (OEIS A024351, OEIS A320872) (Madachy 1979, p. 95; Pickover 2002, pp. 195-196; attributed to R. Ondrejka).

PrimeMagicSquareJohnson

The 4×4 prime magic square illustrated above was found by A. W. Johnson, Jr. (Dewdney 1988). It has the smallest possible magic constant 120 (OEIS A164843).

PrimeMagicSquareSallows

L. Sallows (pers. comm., Nov. 14, 2013) gave the 4×4 prime magic square illustrated above, which has the same magic constant 120 (OEIS A164843) as Johnson's example but a largest entry of 71 instead of 73.

PrimeMagicSquareArithmeticProgression

The 3×3 prime magic square illustrated above consists of primes in arithmetic progression (199+210n) and has the smallest possible magic constant 3117 (OEIS A269904) for this type of square (Madachy 1979, p. 95; attributed to R. Ondrejka).

ConsecutivePrimesMagicSq2

The smallest nontrivial magic square composed of consecutive odd primes including the number 1 is of order 12, illustrated above (OEIS A364538). Gardner (1984, pp. 86-87) attributes a 1913 proof to J. N. Muncey, whose square was published by Andrews and Sayles (1913, pp. 629-630).

Orders 13 and 14 are impossible because the sum of the required entries is not divisible by the order.

PrimeMagicSquareBorodi

The next possible order for this type of magic square is therefore 15. Examples containing 1 and the consecutive odd primes through 1427 have the smallest possible magic constant 9635 (OEIS A073502) (Tognon 2002). The distinct arrangement illustrated above was independently reported by R. Borodi (pers. comm., Aug. 11, 2013).

More generally, if S is the sum of 1 and the first n^2-1 odd primes, necessary conditions are that S/n is an integer and S/n=n  (mod2). The orders satisfying these conditions begin 1, 2, 3, 12, 15, 17, 22, 35, ... (OEIS A173079). These conditions alone do not guarantee the existence of a magic square.

R. Borodi (pers. comm., Nov. 1, 2026) constructed an order-17 example containing 1 and the first 288 odd primes, through 1879, with magic constant 14691. An earlier order-17 construction appears in Tognon (2002).

ConsecutivePrimesMagicSq

The 3×3 square whose entries are consecutive primes illustrated above (OEIS A073519, OEIS A320873) was discovered by Nelson (Guy 1994, p. 18; Pickover 2002, p. 196; Rivera) in response to a challenge by Martin Gardner. It has the smallest possible magic constant 4440084513 (OEIS A073520) among 3×3 squares of consecutive primes. Nelson collected Gardner's $100 prize, and also found 20 other such squares (Guy 1994, p. 18).

PrimeMagicSquareMadachy

The amazing square above (Madachy 1979, pp. 93-94) is a 13×13 prime magic border square, so that the 11×11, 9×9, ..., and 3×3 subsquares are all also prime magic squares.


See also

Magic Square, Prime Array, Prime Number

Explore with Wolfram|Alpha

References

Andrews, W. S. and Sayles, H. A. "Magic Squares Made with Prime Numbers to Have the Lowest Possible Summations." Monist 23, 623-630, 1913. https://doi.org/10.5840/monist191323435.Dewdney, A. K. "Computer Recreations: How to Pan for Primes in Numerical Gravel." Sci. Amer. 259, pp. 120-123, July 1988.Dudeney, H. E. "Magic Squares of Primes." In Amusements in Mathematics. New York: Dover, 1970.Gardner, M. The Sixth Book of Mathematical Games from Scientific American. Chicago, IL: University of Chicago Press, 1984.Guy, R. K. Unsolved Problems in Number Theory, 2nd ed. New York: Springer-Verlag, 1994.Heinz, H. "Prime Magic Squares." https://web.archive.org/web/20241227153646/http://www.magic-squares.net/primesqr.htm.Madachy, J. S. "Magic and Antimagic Squares." Ch. 4 in Madachy's Mathematical Recreations. New York: Dover, pp. 85-113, 1979.Nelson, H. L. "A Consecutive Prime 3×3 Magic Square." J. Recr. Math. 20, 214-216, 1988.Pickover, C. A. The Zen of Magic Squares, Circles, and Stars: An Exhibition of Surprising Structures across Dimensions. Princeton, NJ: Princeton University Press, 2002.Rivera, C. "Problems & Puzzles: Puzzle 003-Magic Squares with Consecutive Primes." https://www.primepuzzles.net/puzzles/puzz_003.htm.Rivera, C. "Problems & Puzzles: Puzzle 004-Prime-Magical Squares." https://www.primepuzzles.net/puzzles/puzz_004.htm.Tognon, S. "Manual Construction." Archived Dec. 2, 2002. https://web.archive.org/web/20021202190708/http://digilander.libero.it:80/ice00/magic/prime/ManualConstruction.html.Sloane, N. J. A. Sequences A024351, A073473, A073502, A073519, A073520, A164843, A173079, A269904, A320872, A320873, and A364538 in "The On-Line Encyclopedia of Integer Sequences."

Referenced on Wolfram|Alpha

Prime Magic Square

Cite this as:

Weisstein, Eric W. "Prime Magic Square." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/PrimeMagicSquare.html

Subject classifications