# Abu’l-Wafa al-Buzjani

Abu’l-Wafa al-Buzjani (940 – 997/998) was an outstanding Persian mathematician and astronomer of the Middle Ages, who among other things wrote several books on mathematics. His treatise on magic squares of different orders is one of the two oldest known works on the subject.

In many construction methods from the arab world, the squares are filled frame by frame from the outside towards the center. Abu'l-Wafa al-Buzjani also begins with the outer border, which is filled with the first 2n − 2 numbers according to a certain scheme. In the case of order n=9 this means 2 · 9 − 2=16 numbers. His method uses the following steps:

• The first k − 1 odd numbers are placed in the left column. You start above the lower left corner and continue upwards with the odd ones. With n=2k + 1, i.e. k=4, the numbers 1, 3 and 5 are placed in this column.
• The next odd number 7 is placed in the center cell of the bottom row and the following odd number in the center cell of the right column.
• The remaining k − 1 odd numbers are finally placed in ascending order in the free spaces above the center of the right column.
• Now the even numbers follow. The first k −1 even numbers 2, 4 and 6 are entered continuously to the right of the lower left corner.
• The next two even numbers follow one after the other in the left or right upper corner of the square.
• The remaining 2 · (k − 1) numbers are placed into the top row. You start to the right of the center and fill the empty cells in ascending order up to the top right corner.

Finally, the cells that are still free are filled with the complements of the numbers already entered. These complements are always placed in the opposite end of the respective row or column. The only exception is the two upper corners. As always with bordered magic squares, their complement must be entered in the diagonally opposite corner.

•  8 12 14 16 10 15 13 11 9 5 3 1 2 4 6 7
•  8 80 78 76 75 12 14 16 10 67 15 69 13 71 11 73 9 5 77 3 79 1 81 72 2 4 6 7 70 68 66 74

This procedure can now be continued from the outside towards the center. For the border of the inner square with order n=7, the result is shown in the next figure.

•  8 80 78 76 75 12 14 16 10 67 22 26 28 24 15 69 27 13 71 25 11 73 23 9 5 19 77 3 17 79 1 18 20 21 81 72 2 4 6 7 70 68 66 74
•  8 80 78 76 75 12 14 16 10 67 22 64 62 61 26 28 24 15 69 55 27 13 71 57 25 11 73 59 23 9 5 19 63 77 3 17 65 79 1 58 18 20 21 56 54 60 81 72 2 4 6 7 70 68 66 74

This principle is applied to the remaining subsquares, until the complete multi-bordered magic square is finally created.

 8 80 78 76 75 12 14 16 10 67 22 64 62 61 26 28 24 15 69 55 32 52 51 36 34 27 13 71 57 47 38 45 40 35 25 11 73 59 49 43 41 39 33 23 9 5 19 29 42 37 44 53 63 77 3 17 48 30 31 46 50 65 79 1 58 18 20 21 56 54 60 81 72 2 4 6 7 70 68 66 74

Remarks:

• The number that corresponds to the order of the magic square is always in the middle of the right column.
• The middle nine numbers of the number sequence from 1 to n2 are located in the central inner square of size 3x3.
• The median of all entered numbers, i.e. 41, is placed in the center cell of the square.

This procedure works for all odd orders. Two further examples for n=5 and n=7 are shown in the figure below.

•  4 24 23 8 6 19 10 17 12 7 21 15 13 11 5 1 14 9 16 25 20 2 3 18 22
•  6 48 46 45 10 12 8 39 16 36 35 20 18 11 41 31 22 29 24 19 9 43 33 27 25 23 17 7 3 13 26 21 28 37 47 1 32 14 15 30 34 49 42 2 4 5 40 38 44

### Variants

In arabic literature you can also find slightly modified squares, in which the number sequences coming to the top right corner are not arranged in ascending order as in the previous example, but in descending order.

The two changed areas of the outer border are marked in the following figure.

 8 80 78 76 75 16 14 12 10 71 22 64 62 61 28 26 24 11 69 57 32 52 51 36 34 25 13 67 55 47 38 45 40 35 27 15 73 59 49 43 41 39 33 23 9 5 19 29 42 37 44 53 63 77 3 17 48 30 31 46 50 65 79 1 58 18 20 21 54 56 60 81 72 2 4 6 7 66 68 70 74

In another variant, the numbers in the two upper corners are changed and the numbers 4k − 2 and 4k are selected here. Of course, this also changes the other even numbers in the top row. Again, only the changes in the figure on the left are shown.

•  14 80 78 76 75 8 10 12 16 67 26 64 62 61 22 24 28 15 69 55 34 52 51 32 36 27 13 71 57 47 38 45 40 35 25 11 73 59 49 43 41 39 33 23 9 5 19 29 42 37 44 53 63 77 3 17 46 30 31 50 48 65 79 1 54 18 20 21 60 58 56 81 66 2 4 6 7 74 72 70 68
•  14 12 10 8 75 76 78 80 16 67 26 24 22 61 62 64 28 15 69 55 34 32 51 52 36 27 13 71 57 47 38 45 40 35 25 11 73 59 49 43 41 39 33 23 9 5 19 29 42 37 44 53 63 77 3 17 46 50 31 30 48 65 79 1 54 58 60 21 20 18 56 81 66 70 72 74 7 6 4 2 68

There are also squares like the one on the right, in which the odd and even numbers are not entered starting at a common corner, but at different corners.