Hits: 74

Click here for my previous article on 4×4 Magic Squares.

Click here for an even earlier article on 4×4 Magic Squares.

Much of the work from that article came from an Excel spreadsheet, which I forgot to save. No big deal, I re-constructed the 24 squares again using Grogono’s magic carpets. But as I was doing this I was finding to my horror that these new magic squares – all proven to be pan-magic — were different from the 24 squares in the previous article. What was notably absent was the number 16 in the upper left and the 1 in row 3, column 3, which occured in all 24 of the squares generated yesterday. In fact, what had happened instead is that the 1 and the 16 switched places. Weird.

So, I took a closer look. And I found out that in the last article, I based my carpets on a scheme I found on the internet. Again, it looks like this:

This was not what I got from the Grogono site. The Grogono site had a scheme more like this:

Every placeholder and zero are switched. What had a zero now has a placeholder, and what was a placeholder now has a zero. While the “pan-magicness” was not affected, we appeared to obtain new magic squares.

But what if I picked and chose which carpets to invert, and which to leave as-is. Would the result still be magic? That is, could I still get pan-magic if I chose to invert only one random carpet, or two, or three random carpets?

From what I have investigated, it appears that in all cases, yes, that is what will happen. And when I did that, I began to notice squares which were rotated or flipped versions of other existing squares. Below are the 16 squares generated from square “1248” from the previous day’s posting, by inverting one, two, three or all four magic carpets in all possible permutations, never changing the ordering of the carpets. All of these are pan-magic.

1 | 15 | 4 | 14 | Original | |||||||||||||||

12 | 6 | 9 | 7 | ||||||||||||||||

13 | 3 | 16 | 2 | ||||||||||||||||

8 | 10 | 5 | 11 | ||||||||||||||||

1 | 2 | 3 | 4 | ||||||||||||||||

2 | 16 | 3 | 13 | 4 | 14 | 1 | 15 | 8 | 10 | 5 | 11 | 16 | 2 | 13 | 3 | ||||

11 | 5 | 10 | 8 | 9 | 7 | 12 | 6 | 13 | 3 | 16 | 2 | 5 | 11 | 8 | 10 | ||||

14 | 4 | 15 | 1 | 16 | 2 | 13 | 3 | 12 | 6 | 9 | 7 | 4 | 14 | 1 | 15 | ||||

7 | 9 | 6 | 12 | 5 | 11 | 8 | 10 | 1 | 15 | 4 | 14 | 9 | 7 | 12 | 6 | ||||

5 | 6 | 7 | 8 | ||||||||||||||||

3 | 13 | 2 | 16 | 5 | 11 | 8 | 10 | 7 | 9 | 6 | 12 | 15 | 1 | 14 | 4 | ||||

10 | 8 | 11 | 5 | 16 | 2 | 13 | 3 | 14 | 4 | 15 | 1 | 6 | 12 | 7 | 9 | ||||

15 | 1 | 14 | 4 | 9 | 7 | 12 | 6 | 11 | 5 | 10 | 8 | 3 | 13 | 2 | 16 | ||||

6 | 12 | 7 | 9 | 4 | 14 | 1 | 15 | 2 | 16 | 3 | 13 | 10 | 8 | 11 | 5 | ||||

9 | 10 | 11 | 12 | ||||||||||||||||

11 | 5 | 10 | 8 | 13 | 3 | 16 | 2 | 9 | 7 | 12 | 6 | 6 | 12 | 7 | 9 | ||||

2 | 16 | 3 | 13 | 8 | 10 | 5 | 11 | 4 | 14 | 1 | 15 | 15 | 1 | 14 | 4 | ||||

7 | 9 | 6 | 12 | 1 | 15 | 4 | 14 | 5 | 11 | 8 | 10 | 10 | 8 | 11 | 5 | ||||

14 | 4 | 15 | 1 | 12 | 6 | 9 | 7 | 16 | 2 | 13 | 3 | 3 | 13 | 2 | 16 | ||||

13 | 14 | 15 | |||||||||||||||||

10 | 8 | 11 | 5 | 12 | 6 | 9 | 7 | 14 | 4 | 15 | 1 | ||||||||

3 | 13 | 2 | 16 | 1 | 15 | 4 | 14 | 7 | 9 | 6 | 12 | ||||||||

6 | 12 | 7 | 9 | 8 | 10 | 5 | 11 | 2 | 16 | 3 | 13 | ||||||||

15 | 1 | 14 | 4 | 13 | 3 | 16 | 2 | 11 | 5 | 10 | 8 |

Changing the ordering of the carpets makes no difference in the resulting magic square, as addition is commutative. Throughout these past two postings, I have always kept the carpets in one order while trying out all possible substitutions of the numbers 1, 2, 4, and 8 on them. The above set are variations on 1248 with each new variant labelled from 1 to 16, which labels are highlighted in yellow.

Keeping the ordering of the carpets the same as in the two illustrations at the start of this article, let a “1” represent an inverted, Grogono carpet, and a “0” represent a member from the first set of carpets. So, a “1111” would repsent the fact that all Grogono carpets were used, and “0000” represent the idea that all carpets were used as per the first illustration, or as seen in the last posting. Something like “0100” would tell you that only the second carpet was the inverted Grogono carpet, and the rest were the original carpets I used. I wish I could say that the 16 magic squares illustrated above went with the ordering of the binary numbers, but instead I began my spreadsheet experimentally with some random choices, then proceeded to fill out the missing combinations as I went. What follows is the actual ordering of those squares.

(the original 1248 square from the last post, not numbered)

I count magic squares, while being aware that many of them are rotations or reflections, possibly of the first 24. For example, squares 1 and 7 is a reflection; 2 and 13 is a rotation, as is 3 and 15. So, I am quite sure that 384 will not be anywhere close to the count when rotations and reflections are taken into consideration.

The new magic squares I have obtained are thus, using the Grogono carpets:

1248 | 1284 | 1248 | 1482 | ||||||||||||||||

1 | 15 | 4 | 14 | 1 | 15 | 4 | 14 | 1 | 15 | 6 | 12 | 1 | 15 | 6 | 12 | ||||

12 | 6 | 9 | 7 | 8 | 10 | 5 | 11 | 14 | 4 | 9 | 7 | 8 | 10 | 3 | 13 | ||||

13 | 3 | 16 | 2 | 13 | 3 | 16 | 2 | 11 | 5 | 16 | 2 | 11 | 5 | 16 | 2 | ||||

8 | 10 | 5 | 11 | 12 | 6 | 9 | 7 | 8 | 10 | 3 | 13 | 14 | 4 | 9 | 7 | ||||

1824 | 1842 | 2148 | 2184 | ||||||||||||||||

1 | 15 | 10 | 8 | 1 | 15 | 10 | 8 | 1 | 14 | 4 | 15 | 1 | 14 | 4 | 15 | ||||

14 | 4 | 5 | 11 | 12 | 6 | 3 | 13 | 12 | 7 | 9 | 6 | 8 | 11 | 5 | 10 | ||||

7 | 9 | 16 | 2 | 7 | 9 | 16 | 2 | 13 | 2 | 16 | 3 | 13 | 2 | 16 | 3 | ||||

12 | 6 | 3 | 13 | 14 | 4 | 5 | 11 | 8 | 11 | 5 | 10 | 12 | 7 | 9 | 6 | ||||

2418 | 2481 | 2814 | 2841 | ||||||||||||||||

1 | 14 | 7 | 12 | 1 | 14 | 7 | 12 | 1 | 14 | 11 | 8 | 1 | 14 | 11 | 8 | ||||

15 | 4 | 9 | 6 | 8 | 11 | 2 | 13 | 15 | 4 | 5 | 10 | 12 | 7 | 2 | 13 | ||||

10 | 5 | 16 | 3 | 10 | 5 | 16 | 3 | 6 | 9 | 16 | 3 | 6 | 9 | 16 | 3 | ||||

8 | 11 | 2 | 13 | 15 | 4 | 9 | 6 | 12 | 7 | 2 | 13 | 15 | 4 | 5 | 10 | ||||

4128 | 4182 | 4218 | 4281 | ||||||||||||||||

1 | 12 | 6 | 15 | 1 | 12 | 6 | 15 | 1 | 12 | 7 | 14 | 1 | 12 | 7 | 14 | ||||

14 | 7 | 9 | 4 | 8 | 13 | 3 | 10 | 15 | 6 | 9 | 4 | 8 | 13 | 2 | 11 | ||||

11 | 2 | 16 | 5 | 11 | 2 | 16 | 5 | 10 | 3 | 16 | 5 | 10 | 3 | 16 | 5 | ||||

8 | 13 | 3 | 10 | 14 | 7 | 9 | 4 | 8 | 13 | 2 | 11 | 15 | 6 | 9 | 4 | ||||

4812 | 4821 | 8124 | 8142 | ||||||||||||||||

1 | 12 | 13 | 8 | 1 | 12 | 13 | 8 | 1 | 8 | 10 | 15 | 1 | 8 | 10 | 15 | ||||

15 | 6 | 3 | 10 | 14 | 7 | 2 | 11 | 14 | 11 | 5 | 4 | 12 | 13 | 3 | 6 | ||||

4 | 9 | 16 | 5 | 4 | 9 | 16 | 5 | 7 | 2 | 16 | 9 | 7 | 2 | 16 | 9 | ||||

14 | 7 | 2 | 11 | 15 | 6 | 3 | 10 | 12 | 13 | 3 | 6 | 14 | 11 | 5 | 4 | ||||

8214 | 8241 | 8412 | 8421 | ||||||||||||||||

1 | 8 | 11 | 14 | 1 | 8 | 11 | 14 | 1 | 8 | 13 | 12 | 1 | 8 | 13 | 12 | ||||

15 | 10 | 5 | 4 | 12 | 13 | 2 | 7 | 15 | 10 | 3 | 6 | 14 | 11 | 2 | 7 | ||||

6 | 3 | 16 | 9 | 6 | 3 | 16 | 9 | 4 | 5 | 16 | 9 | 4 | 5 | 16 | 9 | ||||

12 | 13 | 2 | 7 | 15 | 10 | 5 | 4 | 14 | 11 | 2 | 7 | 15 | 10 | 3 | 6 |

##### How many 4×4 magic squares are there?

In 1933, a mathematician who taught at UC Berkeley named Derrick Norman Lehmer published a short paper in the October 1933 edition of the *Bulletin of the American Mathematical Society*, entitled “A Complete Census of 4×4 Magic Squares”. In this paper, he deals with magic squares generally, not just the pan-magic ones. He asserted that there are 539,136 magic squares of order 4 in total.

His way of counting involves the ability to normalize them by rearranging the numbers in a methodical way which shows that squares showing a different normalization cannot be transformed by shuffling columns or rows. It turns out that there are 468 normalized squares of order 4. Each of these 468 normalized squares has possible shufflings of its rows and columns to produce different squares. And thus, .

As for order-4 pan-magic squares, there are 52 ways to obtain a total of 34. The diagram below came from a Ted Talk by mathematician Michael Daniels, and illustrates the 52 ways to obtain the total.

Grogono also offers a diagram where you can see the effects of changing the numbers on a 4×4 magic square, the inversion of the carpets, and so on. You just have to remember that for his squares, the numbering starts from 0 and the magic number is 30. So, that to get the magic number 34, you need to add 1 to each position in the magic square.