The algorithm of Bachet and Labosne uses with two auxiliary squares. In a first step, the two diagonals of the first auxiliary square are filled from left to right with the numbers 1 to n in ascending order. The columns in the left half are then filled with the already existing numbers and their numbers complementary to n+1. Each of the two possible numbers must occur exactly m=n/2 times.
When all columns of the left half are filled, the horizontally symmetrical cells of the right half are filled with the complementary numbers.
1
6
2
5
3
4
3
4
2
5
1
6
1
2
4
6
6
2
4
5
1
5
3
4
6
5
3
4
6
2
3
5
1
5
4
6
1
2
4
3
5
6
6
2
4
3
5
1
1
5
3
4
2
6
6
5
3
4
2
1
6
2
3
4
5
1
1
5
4
3
2
6
In the second auxiliary square, the secondary diagonal is filled with the numbers 0, n, 2n, … , (n-1) · n from top left to bottom right. In the example of order n=6, these would be the numbers 0, 6, 12, 18, 24 and 30. On the main diagonal, however, the numbers from the bottom left to the top right are entered in reversed order.
Similar to the procedure for the columns in the first auxiliary square, the lower m rows are now filled with the existing numbers and their numbers complementary to (n-1) · n so that each of the two possible numbers is represented exactly m times.
0
0
6
6
12
12
18
18
24
24
30
30
0
0
6
6
12
12
12
18
18
18
12
12
6
24
6
6
24
24
30
0
30
0
0
30
However, there is an additional rule to be observed: if in a row of the first auxiliary square two horizontally symmetrical numbers are complementary with respect to n+1 to their vertically symmetrical numbers, the same numbers must be placed in the corresponding row of the second auxiliary square and in the symmetrical row the complementary numbers.
For example, the numbers 5 and 2 are in the bottom row of the first auxiliary square and the complementary numbers 2 and 5 are in the symmetrical cells of the top row. The special rule now applies, and the same number must be entered in the two cells of the bottom row. Although the two numbers 0 and 30 are principally available for this row, you must enter the number 0 in this case, otherwise the number 30 would occur too often.
1
2
4
3
5
6
6
2
4
3
5
1
1
5
3
4
2
6
6
5
3
4
2
1
6
2
3
4
5
1
1
5
4
3
2
6
0
0
6
6
12
12
18
18
24
24
30
0
0
30
Two other cases of this special rule occur in the two middle columns of the second row from below and in the two outer columns of the row above. Here too, the same numbers must be entered in the corresponding rows. The result using the special rule is shown in the following figures.
1
2
4
3
5
6
6
2
4
3
5
1
1
5
3
4
2
6
6
5
3
4
2
1
6
2
3
4
5
1
1
5
4
3
2
6
0
0
6
6
12
12
18
18
24
6
6
24
30
0
0
30
1
2
4
3
5
6
6
2
4
3
5
1
1
5
3
4
2
6
6
5
3
4
2
1
6
2
3
4
5
1
1
5
4
3
2
6
0
0
6
6
12
12
12
18
18
12
24
6
6
24
30
0
0
30
For order n=6, the two numbers already entered on the diagonals mean that there is no choice, which numbers can be placed due to this special rule. With higher orders, you have several options.
When the bottom half of the rows is filled, the vertically symmetrical cells are filled with the numbers complementary with respect to (n-1) · n.
0
0
6
6
12
12
12
18
18
18
12
12
6
24
6
6
24
24
30
0
30
0
0
30
0
30
0
30
30
0
24
6
24
24
6
6
18
12
12
12
18
18
12
18
18
18
12
12
6
24
6
6
24
24
30
0
30
0
0
30
Finally, the two auxiliary squares only have to be put together to create a magic square. Due to the special choice of the numbers in the two auxiliary squares, it is sufficient to simply add the corresponding cells and a magic square is created.
1
2
4
3
5
6
6
2
4
3
5
1
1
5
3
4
2
6
6
5
3
4
2
1
6
2
3
4
5
1
1
5
4
3
2
6
0
30
0
30
30
0
24
6
24
24
6
6
18
12
12
12
18
18
12
18
18
18
12
12
6
24
6
6
24
24
30
0
30
0
0
30
1
32
4
33
35
6
30
8
28
27
11
7
19
17
15
16
20
24
18
23
21
22
14
13
12
26
9
10
29
25
31
5
34
3
2
36
In my PDF book, this difficult construction is also shown for order n=10.