Monday, January 31, 2005

Counting Magic Squares

I have been fooling around with magic squares on and off, mostly off, since 1972. Early on the focus was on construction of interesting squares, in particular on intersecting magic squares. In 1974 I constructed overlapping 11x11 and 13x13 magic squares, where the overlap was a 5x5 magic square, the product of 2-3 hours of tangram like shuffling on a rainy afternoon. I showed it to my topology professor, who asked about the underlying algorithm, and was nonplussed that I did not have one. At his suggestion I sent it to Martin Gardner, who was then still doing his column at the Scientific American. No reply. I neglected to make a copy.

Last July I researched online to see what was new. The professional literature is way over my head. The amateur web sites were somewhat interesting. I learned that the number of magic squares of order 6 remained a unsolved problem. I worked a bit at (APL) coding algorithms to count all the magic squares of order 4. Order 4 is manageable on a single PC, and takes about 2 seconds to execute. The algorithm is general but requires, due to array size, a 64-bit machine for order 5.

I then spent a couple of months investigating the possibililty of counting the number of magic squares without actually constructing them, using order 4 as an empirical springboard.

In November I emailed the researcher who solved the problem for order 5 back in 1973. His name is Rich Shroeppel. He kindly mailed me a copy of his unpublished writeup of the algorithm he used. I was pleased to see that his line of attack paralleled the strategy I had been reinventing. But mine was different. I wondered if he had tried mine as well, and had abandoned it as inferior.

Oops! Time for the day job. To be continued.