# Moschopoulos I

A very simple method to create magic squares of odd order is known as Moschopoulos. But nowadays, we know from a writing by an unknown author from the 12th century that the algorithm known as Moschopoulos actually comes from Ibn al-Haytham (approx. 965 – 1041).

This method creates magic squares for all odd orders n and was the most common method in the years after its creation due to its simplicity. It can be described with the following steps.

• Place the first number in the cell just below the center cell of the square.
• Determine the next cell by going one row down and one column to the right.
• After exactly n steps, you come to an already occupied cell. Then instead take an intermediate step that takes you down two rows from the last occupied cell.
• Whenever you are leave the square at one end, continue at the opposite side of the square.

At the beginning, we place the number 1 in the cell directly below the center of the square. For the second number, we have to move down one row and one column to the right. Likewise for the third number, and get a position that is outside the square. But since we look at the rows and columns cyclically, we can add the order of the square from the row number and again get a row number that lies within the square. In other words, we walk around the square in the same column and continue at the opposite end. With the fourth step, there is again a small problem, as we have moved out of the square to the right. The first group of five numbers is now correctly positioned. The next number, however, already creates a new problem, since the number 6 would lead to the cell already occupied by the number 1. At this point, the given sequence of steps must be interrupted with a special intermediate step, in which we simply move down two rows from the last occupied cell. You can continue with these steps until the entire square is filled with the numbers 1, 2, 3, … , n2.

 11 24 7 20 3 4 12 25 8 16 17 5 13 21 9 10 18 1 14 22 23 6 19 2 15