Magic Square
Generate and print normal magic squares of order n >= 3.
About this tool
Build a normal magic square of order n ≥ 3 (rows, columns and both diagonals all sum to the magic constant M = n(n²+1)/2).
Algorithms
- n odd — Siamese / De la Loubère
- n = 4k — doubly-even, swap-on-diagonal pattern
- n = 4k+2 — Strachey (LUX), four odd-sub-squares + Strachey swaps
The status line verifies the result and reports the algorithm cost.