# How does the Siamese method to construct any size of n-odd magic squares work?

A Magic Square of order n is an arrangement of $n^2$ numbers, usually distinct integers, in a square, such that the n numbers in all rows, all columns, and both diagonals sum to the same constant.

To construct Magic Squares of n-odd size, a method known as Siamese method is given on Wikipedia, the method is ::

starting from the central box of the first row with the number 1 (or
the first number of any arithmetic progression), the fundamental
movement for filling the boxes is diagonally up and right (↗), one step
at a time. When a move would leave the square, it is wrapped around to
the last row or first column, respectively.

If a filled box is encountered, one moves vertically down one box (↓)
instead, then continuing as before.


How does this method work?

-

The basic idea is that you divide the numbers from $1$ to $n^2$ into blocks $(1,n), (n+1,2n), (2n+1,3n) \ldots (n^2-n+1,n^2)$ and think of them as $0+(1,n), n+(1,n), 2n+(1,n) \ldots n(n-1)+(1,n)$. Then you want each row to get each of $(1,n)$ and each column to get each of $(1,n)$. The various runs of $n$ numbers start one in each row and each column, so they each go one per row and column. Each multiple of $n$ also goes one per row and column. It is a Greco-Latin square, if you make the Greek letters correspond to $(1,n)$ and the Latin letters correspond to $(0,(n-1)n)$
@GerryMyerson: I was hoping to explain that the diagonal movement distributes the numbers properly to ensure that each row and column get a number $1 \pmod n, 2 \pmod n 3 \pmod n \ldots 0 \pmod n$ and also a number in each bracket of $n$ numbers. Maybe it didn't come through. The site you cited looks very good. –  Ross Millikan Jul 27 '12 at 1:57