I have met with some disappointment as to how a methodology for creating a 4×4 square should pan out, and instead I have come up with many different algorithms, each resulting in its own small sets of magic squares, but had stumbled upon a set of squares with similar “hyper-magical” properties which I called the Durer Series.

I had met with some disappointment at this, and am still in the middle of writing my own 4×4 square program in Visual Basic .NET (it’s going to use a “brute force” algorithm … sorry!). With that, I had to learn about how .NET does objects. To those of you out of the loop on the recent .NET versions of VB, this language actually allows you to create your own novel objects, thus saving processing time if the right kind of objects are created. It’s a work in progress.

For now, I wanted to centre on the *pièce de résistance* of this series: that of the odd-ordered magic squares, those of order 5 and beyond. As I hinted at the beginning of this series, these are special and unique in that an algorithm can be made for an order-n magic square (where n is odd) which can generate (*n*!)^{2} squares, all magic (even after weeding out duplicates, the numbers of unique squares will still be in the thousands).

This seems to be a hard-to-find algorithm, except from a book called “The Fascination of Numbers”, written on the year of The Queen’s coronation in 1957 by W. J. Reichmann while he was still a headmaster at a Grammar School located in Spalding, Lincolnshire, England (according to my signed copy of the book, purchased from an English vendor through Amazon used books). I read it for the first time at a university library, and it is likely to be found in a similar univeristy or college collection near you.

What I like about this algorithm is that while I have used it to write computer programs for magic squares, it really requires no more than pencil and paper, and a bit of skill at addition.

First of all, write down the numbers from 1 to 5, in any order at all:

3, 2, 1, 5, 4

A 5×5 square matrix is constructed in a pattern by starting from the fourth number in the sequence, then proceeding with the 5th number, then the first, second and finally the third:

4 2 1 5 3 5 3 4 2 1 2 1 5 3 4 3 4 2 1 5 1 5 3 4 2

Next, scramble the first 5 multiples of 5 (counting 0):

20, 0, 5, 15, 10

Create a 5×5 matrix by shifting the order of these numbers by 2 to the left as follows:

20 0 5 15 10 5 15 10 20 0 10 20 0 5 15 0 5 15 10 20 15 10 20 0 5

Now add them together, adding together numbers located in the same columns and rows in both squares, as in matrix addition:

24 | 2 | 6 | 20 | 13 |

10 | 18 | 14 | 22 | 1 |

12 | 21 | 5 | 8 | 19 |

3 | 9 | 17 | 11 | 25 |

16 | 15 | 23 | 4 | 7 |

The result is a magic square which has many more ways of obtaining the magic number 65 than just adding the rows, columns, and diagonals. Taking any 3×3 sub-square on the corners or left/right sides of this square and adding its corner numbers to the middle number will obtain 65. This seems to be true of all magic squares made by this method. Since both squares can be scrambled independently, there will be (5!)^{2} = 14,400 possible squares before duplicates are weeded out. I have written programs in many languages regarding this 5×5 square, and can attest to the robustness of this algorithm in producing a nearly endless series of 5×5 magic squares, all sharing very similar “magical” properties.

Reichmann also reminds us that the scrambled 5×5 squares we created initially are also magic.

I suspect there may be more than 14,400 magic squares. Are there any squares that cannot be produced by this algorithm? This must be checked against a “brute-force” (read: computational) method for generating all possible magic squares to see if this is really the definitive number. It is certainly a couple of orders of magnitude greater than what Danny Dawson did with his 4×4 squares (around 920 squares or so, with some duplicates). It would also be interesting to know what squares could not have originiated from Reichmann’s algorithm (proven by working backwards to show, supposedly, that duplicate numbers appear in some rows of the first or second matrix, which disappears in the resultant matrix.

It also seems that 4×4 and 5×5 squares can have such “compound” magical properties; it is harder to find for 7×7 matrices, although they are additive to the magic number in just enough ways so as to say they are magic. We’ll leave that for the next journal entry.

## Leave a Reply