In my younger days, having once more leisure time (which I still think
I might have employed more usefully), I had amused myself in making
these kind of magic squares, and, at length acquired such a knack at
it, that I could fill the cells of any magic square of reasonable size
with a series of numbers as fast as I could write them ...
The following array is classified as a normal symmetrical pandiagonal
magic square of odd order.
10
18
1
14
22
11
24
7
20
3
17
5
13
21
9
23
6
19
2
15
4
12
25
8
16
It is a ``magic'' square because all rows and columns sum to the same
number, 65. It is ``pandiagonal'' because not only do both principal
diagonals sum to 65, but so do all five-element broken diagonals
consisting of the m elements on any short diagonal and the
5 - m elements on the corresponding parallel short
diagonal. The array is ``symmetrical'' since any two elements
symmetrically placed about the center sum to n2 +
1 (26 in this case), where n is the length of a side.
The square is said to be ``normal'' because its elements consist of
the integers 1 to n2, each used exactly once.
Finally, the square is obviously ``of odd order'' since n =
5. The magic sum for such squares will always be
n(n2+1)/2, or, as noted, 65 for n =
5. The reason Franklin was able to generate such squares so
easily is that some kinds can be constructed algorithmically; trial
and error is not necessary. The example given was made by following a
generalized version of an algorithm for constructing odd-order squares
that was developed by De la Loubere, Louis XIV's envoy to Siam from
1687 to 1688:
Start by placing the integer 1 in any square.
Move one cell to the right and two cells up and place
2 in that cell; continue moving in that fashion and placing
successive integers. If a move to the right or up takes you
outside the square, consider the square to be cyclic in space
and re-enter at the appropriate point.
If the target cell is already occupied, place the
next number just below the last one that was successfully
placed, and continue as in step 2.
Continue steps 2 and 3 until the square is filled.
(Actually, De la Loubere's original algorithm called for moving
up only one cell, but it has been found that moving like a
knight in chess generates pandiagonal magic squares rather than
squares that are merely magic on rows, columns, and principal
diagonals.)
To see a magic square constructed, provide input for each of the following: