Generate a magic square
Choose an order n and the tool builds a magic square by the construction method historically appropriate to that order, then checks that every row, every column and both main diagonals equal the magic constant n(n² + 1) / 2. The tick (✓) on each sum confirms it matches.
verified — the construction. These are the historical methods, and the output is checkable by addition: the magic constant is forced by the arithmetic, not chosen. A square the tool labels fully magic can be verified by hand against every line.
exploratory — the meaning. That a magic square carries cosmological, planetary or talismanic power is a historical belief, reported on the magic squares essay and not endorsed here. This tool demonstrates how the squares were built, nothing more.
How each method works
Which method applies depends only on the order, and the three cases are genuinely different problems.
Odd orders (3, 5, 7…) — the Siamese method. Place 1 in the middle of the top row and move diagonally up and to the right, wrapping around the edges of the grid. When the target cell is already filled, drop one cell down from the current position instead, and continue. Described for Europe by Simon de la Loubère after his 1687 embassy to Siam, though the rule is older.
Doubly-even orders (4, 8, 12…) — diagonal complement. Write the numbers 1 to n² straight across the grid in order. Then, for every cell lying on a diagonal of its 4×4 block, replace its value v by its complement n² + 1 − v. The rest stay as written.
Singly-even orders (6, 10, 14…) — Strachey’s method. The hard case. Split the square into four quadrants, fill each with a Siamese sub-square shifted by a quarter of the range, then exchange a small, specific set of columns between the left quadrants (and, for larger orders, the right quadrants) to bring the diagonals to the constant. Conway’s LUX method reaches the same end by a different route.
Sources
The history behind these squares, and the cultures that used them, is set out with full references on the companion essay.
- Schuyler Cammann, “The Magic Square of Three in Old Chinese Philosophy and Religion”, History of Religions 1.1 (1961), 37–80.
- Schuyler Cammann, “Islamic and Indian Magic Squares”, Parts I and II, History of Religions 8.3 and 8.4 (1968–69).
- Agrippa von Nettesheim, De occulta philosophia (1533), Book II — the planetary squares.
- W. S. Andrews, Magic Squares and Cubes (Open Court, 1917) — the construction methods, including the Strachey and De la Loubère rules.
Magic Squares Across Cultures
The full history: Lo Shu, budūḥ, Khajuraho, Dürer, Agrippa and Franklin.
He Tu & Luo Shu
The 3×3 square in Chinese cosmology.
Sacred Geometry
The companion test of numerical claims about form.
Alphanumeric Calculator
The site’s other interactive number tool.
Cite this page
Formatted references for this page. The evidence grade is part of the claim — when quoting a graded statement, carry the grade with it.