A prime magic square is a magic square consisting only of prime numbers (although the number 1 is sometimes allowed in such squares). The left square is the prime magic square (containing a 1) having the smallest possible magic constant, and was discovered by Dudeney in 1917 (Dudeney 1970; Gardner 1984, p. 86). The second square is the magic square consisting of primes only having the smallest possible magic constant (Madachy 1979, p. 95; attributed to R. Ondrejka). The third square is the prime magic square consisting of primes in arithmetic progression () having the smallest possible magic constant of 3117 (Madachy 1979, p. 95; attributed to R. Ondrejka). The prime magic square on the right was found by A. W. Johnson, Jr. (Dewdney 1988).
According to a 1913 proof of J. N. Muncey (cited in Gardner 1984, pp. 86-87), the smallest magic square composed of consecutive odd primes including the number 1 is of order 12, illustrated above.
The square whose entries are consecutive primes illustrated above was discovered by Nelson (Guy 1994, p. 18; Rivera) in response to a challenge by Martin Gardner. 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.