Boneyard Tools

How magic squares are built, order by order

The three classical constructions behind every magic square: the Siamese method for odd orders, the diagonal method for doubly even orders, and the Strachey method for singly even orders.

The magic constant

Every normal magic square of order n uses the numbers 1 through n squared once, and each row, column and main diagonal sums to the same value. That value, the magic constant, is n times (n squared plus 1) divided by 2. Knowing it up front lets you check any row at a glance.

Odd orders: the Siamese method

For odd orders you place 1 in the top middle cell and step diagonally up and to the right, wrapping around the edges. When the next cell is already taken you drop straight down one cell instead. This simple walk, also called the de la Loubere method, fills the whole grid into a perfect magic square.

Doubly even orders: the diagonal method

When the order is a multiple of 4 you number the grid in reading order, then look at the diagonals of each 4 by 4 block. Cells on those diagonals are swapped for their complement, n squared plus 1 minus the value. The untouched cells keep their place, and the swaps balance every line.

Singly even orders: the Strachey method

Orders like 6, 10 and 14 are the hardest. The Strachey method builds a smaller odd square, copies it into four quadrants with different offsets, then exchanges a band of columns between the quadrants, with a special shift in the centre row. The result is a full magic square where the simpler methods cannot reach.