On this page
A magic square is an n×n grid of distinct positive integers whose rows, columns and two main diagonals all have the same sum, and a normal magic square uses exactly the numbers 1 to n² (MathWorld, Magic Square). For odd n, one mechanical method builds one every time.
What is the Siamese method for odd magic squares?
The Siamese method, also called the de la Loubère method, constructs magic squares of odd order (MathWorld, Siamese Method). The French diplomat Simon de la Loubère brought it to France in 1688, returning from his 1687 embassy to Siam, and published it in his 1693 book on the kingdom (Wikipedia, Siamese method). He had learnt it from a Frenchman, M. Vincent, who learnt it in Surat, India.
The rules, as MathWorld's magic square entry gives them:
Put 1 in the centre cell of the top row.
Put each next number one cell up and one cell to the right.
If that move leaves the grid, wrap round: off the top comes back at the bottom, off the right comes back at the left.
If the target cell is already filled, put the next number directly below the previous one instead.
Wrapping round is just counting rows and columns mod n, the same idea behind modular exponentiation.
How do you build a 5×5 magic square step by step?
Put 1 in row 1, column 3. Up-right from there leaves the top, so 2 wraps to row 5, column 4. Then 3 goes to row 4, column 5. Up-right from 3 leaves the right edge, so 4 wraps to row 3, column 1, and 5 lands in row 2, column 2.
The cell up-right of 5 already holds 1, so 6 drops below 5, into row 3, column 2, and the climb restarts.
You are blocked exactly after 5, 10, 15 and 20, the multiples of n. The trickiest is 15, in the top-right corner: up-right wraps to the bottom-left cell, which holds 11, so 16 goes below 15. The finished square:
Row 1: 17, 24, 1, 8, 15
Row 2: 23, 5, 7, 14, 16
Row 3: 4, 6, 13, 20, 22
Row 4: 10, 12, 19, 21, 3
Row 5: 11, 18, 25, 2, 9
This matches the order-5 square on the Wikipedia page.
Why is the magic constant n(n² + 1)/2?
The numbers 1 to 25 add up to 25 × 26 / 2 = 325, the usual sum of an arithmetic progression (AP formulas with examples). The five rows share that total equally, so each row must add to 325 / 5 = 65.
In general, the magic constant of a normal n×n magic square is n(n² + 1)/2 (MathWorld, Magic Constant). The first values on that page include 15, 34 and 65, for n = 3, 4 and 5.
Does every row, column and diagonal add to 65?
Yes, all twelve lines:
Rows: 17+24+1+8+15, 23+5+7+14+16, 4+6+13+20+22, 10+12+19+21+3 and 11+18+25+2+9 are each 65.
Columns: 17+23+4+10+11, 24+5+6+12+18, 1+7+13+19+25, 8+14+20+21+2 and 15+16+22+3+9 are each 65.
Diagonals: 17+5+13+21+9 = 65 and 15+14+13+12+11 = 65.
Why does the Siamese method fail for even n?
The Wikipedia page states that the method does not work for even orders. On a 4×4 grid the rules still fill every cell:
Row 1: 9, 15, 1, 7 (sum 32)
Row 2: 14, 4, 6, 12 (sum 36)
Row 3: 3, 5, 11, 13 (sum 32)
Row 4: 8, 10, 16, 2 (sum 36)
Every column adds to 34, the correct constant, but the rows alternate 32 and 36 and both diagonals give 26.
Here is why. The numbers come in runs of n (1 to 4, 5 to 8, ...), and each run starts two rows below the last. In the 5×5, runs start at 1, 6, 11, 16 and 21 in rows 1, 3, 5, 2 and 4: steps of two reach every row when n is odd, so each row gets one 1st-of-run, one 2nd-of-run, and so on. In the 4×4, steps of two reach only rows 1 and 3. Row 1 gets only the 1st and 3rd of each run (9, 15, 1, 7) and comes up 2 short; row 2 gets the 2nd and 4th and comes out 2 over.
Even magic squares do exist. MathWorld counts 880 different 4×4 squares, treating rotations and reflections as the same, and none of order 2 (MathWorld, Magic Square). The same page gives other constructions for them: a crossed-diagonal method for orders divisible by 4 and Conway's LUX method for orders like 6 and 10.
How can you practise it?
Build the 3×3. You should get 8, 1, 6 / 3, 5, 7 / 4, 9, 2, each line adding to 15.
Build the 7×7 and check a row, a column and both diagonals against 7 × 50 / 2 = 175, the magic constant for n = 7.
Use an arithmetic progression: the Wikipedia page shows 5, 10, ... 45 in a 3×3 gives a magic sum of 75.
Run the rules on a 4×4 and find which lines break.
If the AP sum or mod-n wrapping feels shaky, the Fermi Concept Library covers every concept in mathematics, so you can patch the idea behind the trick. For another grid puzzle with a clean rule, read about Hamiltonian cycles and the knight's tour.



