Here are three things about dominoes, two easy and one more advanced.

## Counting

First, how many pieces are there in a set of dominoes? A domino corresponds to an unordered pair of numbers from 0 to n. The most popular form has n = 6, but there are variations with other values of n. You can show that the number of dominoes is

This is because there are n+1 possible numbers (since blanks are a possibility) and each one is either a double or not. The number of ways to choose two distinct numbers is the binomial coefficient and the number of doubles is n+1.

Another way to look at this is that we are selecting two things from a set of n+1 things with replacement and so the number of possibilities is

where the symbol on the left is Stanley’s symbol for selection with replacement.

In any case, there are 28 dominoes when n = 6, 55 when n = 9, and 91 when n = 12.

## Magic squares

There are a couple ways to make a magic square of sorts from a set of dominoes. To read more about this, see this post.

## Tiling

How many ways can you cover an m by n chess board with dominoes? The answer turns out to be

See this post for details.

# Magic squares as matrices

If you view a 3 × 3 magic square as a matrix and raise it to the third power, the result is also a magic square.

More generally, if you multiply an odd number of 3 × 3 magic squares together, the result is a magic square.

For example, here are three magic squares that appeared in my blog post on Spanish magic squares, and you can verify that their product is another magic square.

Source: Martin Gardner, Some New Discoveries About 3 × 3 Magic Squares, Math Horizons, February 1998.

The same article conjectures that the results above are true for magic squares of any odd order. That was 20 years ago. Maybe the conjecture has been resolved by now. If you know, please leave a comment.

Related posts:

# Consecutive pair magic square

The following magic square has a couple unusual properties. For one, numbers appear in consecutive pairs. Also, you can connect the numbers 1 through 32 in a continuous path.

I found this in Before Sudoku. The authors attribute it to William Mannke, “A Magic Square.” Journal of Recreational Mathematics. 1 (3) page 139, July 1968.

Other magic squares:

# Magic hexagon

The following figure is a magic hexagon: the numbers in any straight path through the figure add to 38, even though paths may have length three, four, or five.

I found this in Before Sudoku. The authors attribute it to Madachy’s Mathematical Recreations.

This is essentially the only magic hexagon filled with consecutive integers starting with one. The only others are rotations or reflections of this one, or the trivial case of a single hexagon.

Related posts:

# Magic square rows and columns as numbers

Take any 3 by 3 magic square. For example, here’s the ancient Lo Shu square:

If you read the rows as numbers and sum their squares, you get the same thing whether you read left to right or right to left. In this case

4922 + 3572 + 8162 = 2942 + 7532 + 6182.

Similarly, if you read the columns as numbers and sum their squares, you get the same thing whether you read top to bottom or bottom to top:

4382 + 9512 + 2762 = 8342 + 1592 + 6722.

This doesn’t depend on base 10. It’s true of any base. And the entries of the magic square do not have to be single digits as long as you take the first to be the coefficient of b2, the second the coefficient of b, and the last the coefficient of 1, where b is your base.

In addition to rows and columns, you can get analogous results for diagonals.

4562 + 9782 + 2312 = 6542 + 8792 + 1322

4562 + 3122 + 8972 = 6542 + 2132 + 7982

2582 + 9362 + 4712 = 8522 + 6392 + 1742

2582 + 7142 + 6932 = 8522 + 4172 + 3962

How would you prove this? Arthur Benjamin and Kan Yasuda give an elegant proof here using permutation matrices. Or you could use brute-force starting with Édouard Lucas’ theorem that every 3 by 3 magic square has the following form.

(For each ab, and c there are eight variations on magic square given by Lucas, reflections and rotations of his square.)

Benjamin and Yasuda attribute this discovery to R. Holmes in 1970. “The magic magic square”, The Mathematical Gazette, 54(390):376.

# Alphamagic squares in French

In earlier blog posts I give examples of alphamagic squares in English and in Spanish. This post looks at French.

The Wikipedia article on alphamagic squares, quoting The Universal Book of Mathematics, says

French allows just one 3 × 3 alphamagic square involving numbers up to 200, but a further 255 squares if the size of the entries is increased to 300.

My script did not find a French alphamagic with entries no larger than 200, but it did find 254 squares with entries no larger than 300. (For each of these squares there are 7 more variations you can form by rotation and reflection.)

The French alphamagic square with the smallest maximum entry that I found is the following.

When spelled out in French we get

And when we replace each cell with its number of letters we get the following magic square:

A list of all the French magic squares with maximum element 300 that I found is available here.

# Alphamagic square in Spanish

In a previous post I gave an example of an alphamagic square in English. This is a magic square such that if you replace each number with the letter count when spelling out the word, you get another magic square.

I wondered whether I could find an alphamagic square in Spanish, so I wrote a script to look. I found two. (Plus there are eight rotations and reflections of each.)

The first is the following:

When spelled out in Spanish the numbers are:

And the number of letters in each cell gives:

Here’s a second example:

Spelled out in Spanish:

Sum of the letters:

If my script is correct, these are the only examples (besides their rotations and reflections) for numbers between 1 and 200.

# An alphamagic square

British engineer Lee Sallows came up with the following unusual magic square.

If you spell out the English name of each number

then replace the contents of each cell with the number of letters inside

you get another magic square!

Update: Here are a couple alphamagic squares in Spanish and more in French.

# 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 posts:

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

For daily tweets on algebra and other math, follow @AlgebraFact on Twitter.

# 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.

Related 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.

Related posts:

# 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.

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

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.