Magic square made of dominoes

You can arrange a standard set of dominoes into a magic square of sorts. There are 28 dominoes, each with two ends, so the number of ends isn’t a perfect square. But if you ignore the row of blanks at the bottom, you have a 7 by 7 square where every row, column, and diagonal add to 24. (Technically this isn’t a magic square since some numbers repeat.)

If you don’t use all the dominoes you can make an actual square, no extra row to ignore:

I found the design of these magic squares in The Zen of Magic Squares, Circles, and Stars by Cliff Pickover. He credits Mathematical recreations and essays by Ball and Coxeter.

While the most common set of dominoes goes up to double six, there are other possibilities. I made the images above by pulling out the double six subset out of a set of double nine dominoes. Is it possible to make magic squares like the first photo above out of a full set of dominoes up to double n for other values of n? Not if n is odd, but perhaps if n is even.

You can at least arrange the dominoes into a square. A set of double n dominoes has (n+1)(n + 2)/2 pieces, so (n+1)(n + 2) squares. With a row of n + 1 blanks on the bottom, this leaves (n + 1)2 squares in the magic square. The total number of points in a set of double n dominoes is n(n + 1)(n + 2)/2, so each row, column, and diagonal would have to sum to n(n + 2)/2. This means you cannot arrange a set of double n dominoes into a magic square if n is odd. So, for example, it won’t work for double nine dominoes. Is it possible when n is even? Certainly if n = 6, but what about other values of n?

 

A magic square filled with consecutive primes

In 1988 Martin Gardner offered a $100 prize for the first person to produce a magic square filled with consecutive primes. Later that year, Harry Nelson found 22 solutions using a Cray computer.

1,480,028,201 1,480,028,129 1,480,028,183
1,480,028,153 1,480,028,171 1,480,028,189
1,480,028,159 1,480,028,213 1,480,028,141

Gardner said that the square above is “almost certainly the one with the lowest constant possible for such a square.”

It’s easy to verify that the numbers above are consecutive primes. Here’s a little Python code for the job. The function nextprime(x, i) gives the next i primes after x. We call the function with x equal to one less than the smallest entry in the square and it prints out all the entries.

    from sympy import nextprime
    for i in range(1,10):
        print( nextprime(148028128, i) )

If you’re looking for more than a challenge, verify whether Gardner’s assertion was correct that the square above uses the smallest possible set of consecutive primes.

By the way, assuming Harry Nelson’s Cray was the Y-MP model that came out in 1988, here are its specs according to Wikipedia:

The Y-MP could be equipped with two, four or eight vector processors, with two functional units each and a clock cycle time of 6 ns (167 MHz). Peak performance was thus 333 megaflops per processor. Main memory comprised 128, 256 or 512 MB of SRAM.

Related: Magic squares from a knight’s tour and a king’s tour.

Mars, magic squares, and music

About a year ago I wrote about Jupiter’s magic square. Then yesterday I was listening to the New Sounds podcast that mentioned a magic square associated with Mars. I hadn’t heard of this, so I looked into it and found there were magic squares associated with each of solar system bodies known to antiquity (i.e. Sun, Mercury, Venus, Moon, Mars, Jupiter, and Saturn).

Here is the magic square of Mars:

The podcast featured Secret Pulse by Zack Browning. From the liner notes:

Magic squares provide structure to the music. Structure provides direction to the composer. Direction provides restrictions for the focused inspiration and interpretation of musical materials. The effect of this process? Freedom to compose.

The compositions on this CD use the 5×5 Magic Square of Mars (Secret Pulse), the 9×9 Magic Square of the Moon (Moon Thrust), and the ancient Chinese 3×3 Lo Shu Square found in the Flying Star System of Feng Shui (Hakka Fusion, String Quartet, Flying Tones, and Moon Thrust) as compositional models.  The musical structure created from these magic squares is dramatically articulated by the collision of different musical worlds …

I don’t know how the composer used these magic squares, but you can listen to the title track (Secret Pulse) on the podcast.

More chess-related math posts

Counting magic squares

How many k × k magic squares are possible? If you start from a liberal definition of magic square, there’s an elegant result. For the purposes of this post, a magic square is a square arrangement of non-negative numbers such that the rows and columns all sum to the same non-negative number m called the magic constant. Note that this allows the possibility that numbers will be repeated, and this places no restriction on the diagonals.

With this admittedly non-standard definition, the number of k × k magic squares with magic constant m is always a polynomial in m of degree no more than (k – 1)2. For k = 3, the result is

(m + 1)(m + 2)(m2 + 3m + 4)/8

There is no general formula for all k, but there is an algorithm for finding a formula for each value of k.

Source: The Concrete Tetrahedron

Update: I had reported the polynomial degree as k + 1, but looking back at Concrete Tetrahedron, that book lists the order as (k + 1)2. However, the paper cited in the comments lists the exponent as (k – 1)2, which I believe is correct.

More on magic squares

Jupiter’s magic square

Albrecht Dürer’s engraving Melencolia I contains an interesting magic square toward the top right corner.

Here’s a close-up of the magic square:

The square has the following properties:

  • Every row, column, and diagonal sums to 34.
  • The four squares in the center sum to 34.
  • The four squares in the corners sum to 34.
  • Each quadrant sums to 34.
  • The year the engraving was made, 1514, appears in the bottom row.

I’d seen all this years ago, but this week I learned something else about this square.

Magic squares of different sizes were traditionally associated with planets in the solar system. … the 4 × 4 square in Melancolia is Jupiter’s … One suggestion for Dürer’s use of the square is that it reflected the mystical belief that Jupiter’s joyfulness could counteract the sense of melancholy that pervades the engraving.

From The Number Mysteries.

Regarding “Jupiter’s joyfulness,” here’s the etymology of jovial from Online Etymology Dictionary.

1580s, from Fr., from It. joviale, lit. “pertaining to Jupiter,” from L. Jovialis “of Jupiter,” from Jovius (used as gen. of Juppiter) “Jupiter,” Roman god of the sky. The meaning “good-humored, merry,” is from astrological belief that those born under the sign of the planet Jupiter are of such dispositions. In classical L., the compound Juppiter replaced Old L. Jovis as the god’s name. Related: Jovially.

Related posts

A magic king’s tour

After posting about a magic square made from knight’s tour, I wondered whether there are magic squares made from a king’s tour. (A king can move one square in any direction. A tour is a sequence of moves that lands on each square of a chess board exactly once.) I found George Jelliss’ site via the comments to that post and found out that there are indeed magic king’s tours. Here’s one published in 1917.

Here’s the path a king would take in the square above:

The knight’s tour magic square had rows and columns that sum to 260, though the diagonals did not. In fact, someone has proved that a knight’s tour on an 8×8 board cannot be diagonally magic. (Thanks John V.)

In the king’s tour above, however, the rows, columns, and diagonals all sum to 260. George Jelliss has posted notes that classify all such magic squares that have biaxial symmetry. See his site for much more information.

A knight’s tour magic square

Knight on chessboard

This magic square was created by Leonhard Euler (1707-1783). Each row and each column sum to 260. Each half-row and half-column sum to 130. The square is also a knight’s tour: a knight could visit each square on a chessboard exactly once by following the numbers in sequence.

Here is Python code to verify that the square has the properties listed above.

Update: It seems the attribution to Euler is a persistent error. Euler did publish the first paper on knight’s tours, but the knight’s tour square above was published by William Beverley in 1848. Thanks to George Jelliss for the correction. See the comments below.

Update 2: Notes from George Jelliss on magic king and queen tours.

Update 3: This is technically a semi-magic square: the rows add up to the same magic constant, but the diagonals do not. See Magic square errata.