Ivars Peterson's MathTrek

June 26, 2006

Counting Franklin's Magic Squares

"In my younger days, having once some leisure which I still think I might have employed more usefully, I had amused myself in making . . . magic squares," Benjamin Franklin (1706–1790) wrote in a letter more than 200 years ago.

Typically, a magic square consists of a set of integers arranged in the form of square so that the numbers in each row, column, and diagonal all add up to the same total. If the integers are consecutive numbers from 1 to n2, the square is said to be of nth order. The magic sum itself is given by n(n2 + 1)/2.

Franklin's letter continues, "I could fill the cells of any magic square, of reasonable size, with a series of numbers as fast as I could write them, disposed in such a manner, as that the sums of every row, horizontal, perpendicular, or diagonal, should be equal; but not being satisfied with these, which I looked on as common and easy things, I had imposed on myself more difficult tasks, and succeeded in making other magic squares, with a variety of properties, and much more curious."

Franklin's Autobiography also contains a reference to magic squares. Assembly debates "were often so unentertaining that I was induc'd to amuse myself making magic squares or circles, or any thing to avoid weariness . . .," Franklin admitted.

If he had wished to, Franklin could have claimed credit for inventing an ingenious variant of the magic square. In his most famous example, Franklin arranged the numbers from 1 to 64 in an 8-by-8 grid, one number per cell, so that the sum of each row and column is 260.

Each half-row and half-column sums to 130, so the square is split vertically or horizontally into two magic rectangles. Various other groupings of cells within the grid, including several V-shaped (bent-diagonal) patterns, also add up to 260 or 130. The main, corner-to-corner diagonals, however, do not add up to the magic number.

 52 61 4 13 20 29 36 45 14 3 62 51 46 35 30 19 53 60 5 12 21 28 37 44 11 6 59 54 43 38 27 22 55 58 7 10 23 26 39 42 9 8 57 56 41 40 25 24 50 63 2 15 18 31 34 47 16 1 64 49 48 33 32 17

In the Franklin square shown above, various groupings of cells within the grid, including bent diagonals, add up to 260 or 130. For instance, (52 + 3 + 5 + 54) + (10 + 57 + 63 + 16) = 260 = (55 + 6 + 5 + 51) + (46 + 28 + 27 + 42). Note that the sum of the numbers in any 2-by-2 subsquare is 130.

Only three examples of these bent-diagonal squares have been uncovered so far in Franklin's writings. Now, physicist Peter Loly of the University of Manitoba has determined precisely how many such squares exist: 1,105,920. He used a computer program created by students Daniel Schindel and Matthew Rempel to find the answer, systematically checking all the possible combinations.

"When we started, we didn't know we could do this," Loly says. Instead of getting an exact count, the team originally expected nothing better than a statistical estimate of the prevalence of 8th-order Franklin squares.

"To find an exact result in a reasonable time was a very pleasant surprise," Loly and his team write in an upcoming Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences. "Our count of 1,105,920 dramatically increases the handful of known examples and is some eight orders of magnitude less than a recent upper bound."

In a 2004 paper, mathematician Maya Mohsin Ahmed of the University of California, Davis had worked out that there are no more than about 228 trillion Franklin squares.

In pandiagonal squares, the broken diagonals (parallel to the main diagonal) have the same sum as the main diagonal. Of the 1,105,920 Franklin squares, exactly one-third, 368,640, are pandiagonal and, therefore, fully magic natural Franklin squares.

Here's an example of one of these new finds.

 1 32 38 59 5 28 34 63 46 51 9 24 42 55 13 20 27 6 64 33 31 2 60 37 56 41 19 14 52 45 23 10 11 22 48 49 15 18 44 53 40 57 3 30 36 61 7 26 17 16 54 43 21 12 50 47 62 35 25 8 58 39 29 4

Check out Ivars Peterson's MathTrek blog at http://blog.sciencenews.org/.

References:

Ahmed, M.M. 2004. How many squares are there, Mr. Franklin? Constructing and enumerating Franklin squares. American Mathematical Monthly 11(May):394-410. Available at http://www.math.ucdavis.edu/~maya/franklin.pdf.

Chan, W., and P. Loly. 2002. Iterative compounding of square matrices to generate large-order magic squares. Mathematics Today 38(August):113-118. Preprint available at http://home.cc.umanitoba.ca/~loly/CMPD1.pdf.

Loly, P. 2006. Franklin squares: A chapter in the scientific studies of magical squares. NKS 2006 Wolfram Science Conference. June 17. Washington, D.C. Abstract available at http://www.wolframscience.com/conference/2006/presentations/loly.html.

______. 2004. The invariance of the moment of inertia of magic squares. Mathematical Gazette 88(March):151-153. Preprint available at http://home.cc.umanitoba.ca/~loly/MathGaz.pdf.

______. 2003. Scientific studies of magic squares. In Seventh International History, Philosophy of Science and Science Teaching Conference, Proceedings. Preprint available at http://home.cc.umanitoba.ca/~loly/IHPST.pdf.

Loly, P.D., and M.J. Steeds. 2005. A new class of pandiagonal squares. International Journal of Mathematical Education in Science and Technology 36(No. 4):375-388. Preprint available at http://home.cc.umanitoba.ca/~loly/ijmest2.pdf.

Pasles, P.C. 2006. A bent for magic. Mathematics Magazine 79(February):3-13.

Peterson, I. 2002. More than magic squares. Mathematical Treks: From Surreal Numbers to Magic Circles. Washington, D.C.: Mathematical Association of America.

______. 1996. More than magic squares. MAA Online (Oct. 14).

Pickover, C.A. 2002. The Zen of Magic Squares, Circles, and Stars. Princeton, N.J.: Princeton University Press.

Rogers, A., and P. Loly. 2005. The electric multipole expansion of a magic cube. European Journal of Physics 26(September):809-813. Abstract available at http://www.iop.org/EJ/abstract/0143-0807/26/5/013/.

______. 2005. Rotational sorcery: The inertial properties of magic squares and cubes. Canadian Undergraduate Physics Journal 3(No. 2):25. Available at http://www.cupj.ca/0302_rotational.pdf.

______. 2004. The inertia tensor of magic cubes. American Journal of Physics 72(June):786-789. Abstract available at http://dx.doi.org/10.1119/1.1701845.

Schindel, D., M. Rempel, and P. Loly. In press. Enumerating the bent diagonal squares of Dr Benjamin Franklin. Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences. Abstract available at http://dx.doi.org/10.1098/rspa.2006.1684. Article available at http://www.physics.umanitoba.ca/news/loly_paper.pdf.

Peter Loly has a Web page at http://home.cc.umanitoba.ca/~loly/index.html.

Paul Pasles has pages devoted to Franklin magic squares at http://www.pasles.org/Franklin.html and http://pasles.org/Franklin/index.html.