# construction of magic square of odd length

The construction of an $n\times n$ magic square  with $n$ being odd is simple. (The letter $x$ will be used as a placeholder).

First, place the number 1 in the middle square of the top row.

 $\begin{bmatrix}x&x&1&x&x\\ x&x&x&x&x\\ x&x&x&x&x\\ x&x&x&x&x\\ x&x&x&x&x\\ \end{bmatrix}$

The 2 goes in the bottommost row, in the column to the right of the one where we put the 1. Each subsequent number goes in the row above, in the column to the right, wrapping around as needed.

 $\begin{bmatrix}x&x&1&x&x\\ x&5&x&x&x\\ 4&x&x&x&x\\ x&x&x&x&3\\ x&x&x&2&x\\ \end{bmatrix}$

But if that spot already has a number, the next number goes in the square below instead.

 $\begin{bmatrix}17&x&1&8&15\\ x&5&7&14&16\\ 4&6&13&x&x\\ 10&12&x&x&3\\ 11&x&x&2&9\\ \end{bmatrix}$

And so on and so forth. Of course this procedure can be rotated.

Title construction of magic square of odd length ConstructionOfMagicSquareOfOddLength 2013-03-22 16:25:19 2013-03-22 16:25:19 PrimeFan (13766) PrimeFan (13766) 5 PrimeFan (13766) Algorithm msc 05B15