A prime magic square is a magic square consisting only of prime numbers (although the number 1 is sometimes allowed in such squares).
The
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).
The 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).
The
prime magic square illustrated above was found by A. W. Johnson, Jr. (Dewdney
1988). It has the smallest possible magic constant
120 (OEIS A164843).
L. Sallows (pers. comm., Nov. 14, 2013) gave the 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.
The
prime magic square illustrated above consists of primes
in arithmetic progression (
) and has the smallest
possible magic constant 3117 (OEIS A269904)
for this type of square (Madachy 1979, p. 95; attributed to R. Ondrejka).
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.
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
is the sum of 1 and the first
odd primes, necessary
conditions are that
is an integer and
. 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).
The
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
squares of consecutive primes. Nelson collected Gardner's
$100 prize, and also found 20 other such squares (Guy 1994, p. 18).
The amazing square above (Madachy 1979, pp. 93-94) is a prime magic border square,
so that the
,
, ..., and
subsquares are all also prime magic squares.