De la Loubère is often attributed to this very simple method, but this is not the truth. Simon de la Loubère, who was envoy to the French king in Siam in 1687/88, tried to create a magic square on the return journey using the method of Bachet de Méziriac. A fellow traveler showed him a simpler method that he had learned in India and whose origin can be dated a few hundred years ago.
Let's take a closer look at this algorithm for n=5. At the beginning we place the number 1 in the center cell of the top row. For the second number, we have to move up one row and one column to the right and get a position that is outside the square. However, since we look at the rows and columns cyclically, we can subtract the order of the square from the row number obtained and again get a row number that lies within the square. 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. But this problem is also solved by looking at the columns cyclically.
The first group of 5 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 changed with an intermediate step, simply by going one row down from the last occupied cell.
According to this scheme, you can now continue until the entire square is filled with the numbers 1, 2, 3, … , n2.