Prime Magic Squares
Different Types
Created by Inder J. Taneja
Orders 3–12 · Normal, pandiagonal and structured constructions
Order
Arrangements use the same prime set in different positions. Each result is checked against the selected design. They are not disjoint sets of primes.
Search for a new prime set
Try a common positive even shift of the selected starting example. Adding the same value preserves the design’s sum equalities; a new set is accepted only when every entry is prime. A bounded search may find no new set.
Mathematical requirements
Every complete square has distinct prime entries and equal rows, columns and both principal diagonals. Pandiagonal types additionally satisfy every wrapping diagonal. Perfect Pandiagonal order 4 also checks all wrapping 2×2 blocks.
Normal and Pandiagonal: orders 4–8 each have separate options; further orders retain their named construction variants. Normal requires equal rows, columns and the two principal diagonals; Pandiagonal additionally requires every wrapping diagonal.
For order 5, only Concentric requires a fully magic central 3×3. Cornered and Semi-Striped require equal rows and columns in their 3×3 corner, without a diagonal requirement. Cyclic-Border has four rotated magic rectangles around a central prime.
Orders 9–12 include verified prime constructions with their listed component properties. Every available choice has a verified prime starting example. The order-11 Pandiagonal example is credited to Jarek Wroblewski (AZsPCs 2013 final report).
Order 8 is divided into Type 1 (eight designs) and Type 2: Striped (five striped designs). Its Concentric design preserves both 4×4 and 6×6 magic cores; its Pandiagonal design contains four equal-sum 4×4 magic blocks. Other listed rectangles retain exactly the row, column and diagonal requirements shown in the checks.
Order 7 adds ten types with the required cores, rectangles and wrapping-diagonal checks. Its Pandiagonal starting example (Jarek Wroblewski, OEIS A179440) uses primes 3–239 and magic sum 733. The Normal starting example rearranges the same primes.
Order 6 adds Normal, Pandiagonal, Concentric, Cornered, Border-Nested, Striped-1, Striped-2 and Striped-3. Its 4×4 cores are fully magic in the Concentric and Cornered designs; the 2×2 corner is not required to be magic.
The order-5 Cornered example’s extended 5×2 and 2×5 regions preserve equal columns or equal rows respectively; they are not labelled fully magic rectangles. Exact component sums and diagonal checks appear beneath every square.
The compact order-5 Normal example uses the 25 consecutive primes 13–113 and magic sum 313 (OEIS A272386). The compact order-5 Pandiagonal example uses primes 5–227 and magic sum 395 (V. Pavlovsky, OEIS A179440). The order-6 Pandiagonal example has magic sum 450 and primes 3–167 (Radko Nachev, OEIS A179440). The optional prime-progression mode uses PrimeGrid’s AP26: 43142746595714191 + k × 5283234035979900, k = 0,…,24. Progression reference. Exact integer arithmetic and deterministic Miller–Rabin bases are used for integers below 2⁶⁴. Larger candidates are rejected. Excel stores integers with more than 15 digits as text to preserve their exact values. The progression offers 18 overlapping sets for order 3, 11 for order 4 and 2 for order 5. This file works offline and uses no external scripts.
Show references
Prime Magic Squares: General References
- H. White. Magic Squares of Prime Numbers.
- Heinz, Harvey. Prime Numbers Magic Squares.
- Makarova, Natalia. Concentric magic squares of primes.
- Roberto C. Angelone. A Fully Nested 729 × 729 Unique-Prime Magic Square Constructed from Nine Correlated 243 × 243 Prime Magic Blocks.
- Wolfram MathWorld. Prime Magic Square.
- Magic Tesseract. Prime Order Squares — related constructions for squares of prime order.
- Inder J. Taneja. Prime Magic Squares.
Prime Magic Squares: Block-Structured
- Inder J. Taneja. Block-Structured Prime Magic Squares: Orders 6 to 14. Zenodo, June 16, 2026, pp. 1–41. Research paper · DOI
Web-site Link: Block-Structured Prime Magic Squares: Orders 6 to 14 - Inder J. Taneja. Block-Structured Prime Magic Squares: Orders 15 to 23. Zenodo, June 16, 2026, pp. 1–76. Research paper · DOI
Web-site Link: Block-Structured Prime Magic Squares: Orders 15 to 23 - Inder J. Taneja. Block-Structured Prime Magic Squares: Orders 24, 25 and 26. Zenodo, June 19, 2026, pp. 1–26. Research paper · DOI
Web-site Link: Block-Structured Prime Magic Squares: Orders 24, 25 and 26 - Inder J. Taneja. Block-Structured Prime Magic Squares: Orders 27 to 31. Zenodo, June 22, 2026, pp. 1–59. Research paper · DOI
Web-site Link: Block-Structured Prime Magic Squares: Orders 27 to 31 - Inder J. Taneja. Block-Structured Prime Magic Squares: Orders 32 to 38. Zenodo, June 25, 2026, pp. 1–76. Research paper · DOI
Web-site Link: Block-Structured Prime Magic Squares: Orders 32 to 38 - Inder J. Taneja. Block-Structured Prime Magic Squares: Orders 39 to 43. Zenodo, June 28, 2026, pp. 1–61. Research paper · DOI
Web-site Link: Block-Structured Prime Magic Squares: Orders 39 to 43 - Inder J. Taneja. Block-Structured Prime Magic Squares: Orders 44 to 47. Zenodo, July 1, 2026, pp. 1–59. Research paper · DOI
Web-site Link: Block-Structured Prime Magic Squares: Orders 44 to 47 - Inder J. Taneja. Block-Structured Prime Magic Squares: Orders 48 to 51. Zenodo, July 2, 2026, pp. 1–59. Research paper · DOI
Web-site Link: Block-Structured Prime Magic Squares: Orders 48 to 51
Prime Magic Squares: Higher-Orders
- Inder J. Taneja. Higher-Order Block-Structured Prime Magic Squares: Multiples of 3 and 4. Zenodo, July 10, 2026, pp. 1–30. Research paper · DOI
Web-site Link: Higher-Order Block-Structured Prime Magic Squares: Multiples of 3 and 4 - Inder J. Taneja. Higher-Order Block-Structured Prime Magic Squares: Multiples of 5 and 6. Zenodo, July 10, 2026, pp. 1–23. Research paper · DOI
Web-site Link: Higher-Order Block-Structured Prime Magic Squares: Multiples of 5 and 6 - Inder J. Taneja. Higher-Order Block-Structured Prime Magic Squares: Multiples of 7 and 8. Zenodo, July 12, 2026, pp. 1–31. Research paper · DOI
Web-site Link: Higher-Order Block-Structured Prime Magic Squares: Multiples of 7 and 8 - Inder J. Taneja. Higher-Order Block-Structured Prime Magic Squares: Multiples of 9. Zenodo, July 19, 2026, pp. 1–34. Research paper · DOI
Web-site Link: Higher-Order Block-Structured Prime Magic Squares: Multiples of 9 - Inder J. Taneja. Higher-Order Block-Structured Prime Magic Squares: Multiples of 10. Zenodo, July 19, 2026, pp. 1–34. Research paper · DOI
Web-site Link: Higher-Order Block-Structured Prime Magic Squares: Multiples of 10 - Inder J. Taneja. Higher-Order Block-Structured Prime Magic Squares: Multiples of 11. Zenodo, July 24, 2026, pp. 1–29. Research paper · DOI
Web-site Link: Higher-Order Block-Structured Prime Magic Squares: Multiples of 11 - Inder J. Taneja. Higher-Order Block-Structured Prime Magic Squares: Multiples of 13. Zenodo, July 25, 2026, pp. 1–25. Research paper · DOI
Web-site Link: Higher-Order Block-Structured Prime Magic Squares: Multiples of 13
Prime Magic Squares: Ultra Higher-Orders
- Inder J. Taneja. Concentric Even and Odd Orders Prime Magic Squares: Orders 1222 and 1223. Zenodo, June 17, 2026, pp. 1–24.
Web-site Link: Concentric Even and Odd Orders Prime Magic Squares: Orders 1222 and 1223Revised version of:
- Inder J. Taneja. Single-Layer Bordered Even and Odd Orders Primes Magic Squares: Orders 120 and 121. Zenodo, June 16, 2026, pp. 1–36. Research paper · DOI
Web-site Links: Odd orders · Even orders
- Inder J. Taneja. Single-Layer Bordered Even and Odd Orders Primes Magic Squares: Orders 120 and 121. Zenodo, June 16, 2026, pp. 1–36. Research paper · DOI
- Inder J. Taneja. Higher Order Block-Structured Prime Magic Squares: Order 1220 Multiples of 4. Zenodo, June 16, 2026, pp. 1–27. Research paper · DOI
Web-site Link: Higher Order Block-Structured Prime Magic Squares: Order 1220 Multiples of 4 - Inder J. Taneja. Higher-Order Block-Structured Prime Magic Squares of Order 960: Multiples of 12 with Blocks of Order 3. Zenodo, July 20, 2026, pp. 1–13. Research paper · DOI
Web-site Link: Higher-Order Block-Structured Prime Magic Squares of Order 960: Multiples of 12 with Blocks of Order 3 - Inder J. Taneja. Higher-Order Block-Structured Prime Magic Squares of Order 1024: Multiples of 16 with Blocks of Order 4. Zenodo, July 21, 2026, pp. 1–18. Research paper · DOI
Web-site Link: Higher-Order Block-Structured Prime Magic Squares of Order 1024: Multiples of 16 with Blocks of Order 4