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.