The smallest possible bimagic square using distinct integers
See also the smallest possible bimagic square using consecutive integers

One of the most intriguing problems on multimagic squares: what is the smallest bimagic square using distinct integers? This problem is the Open problem 3 of my article published in The Mathematical Intelligencer (see also the table).

It is impossible to construct bimagic squares smaller than 8x8 and using consecutive integers. But if we allow the use of various but distinct integers, instead of only consecutive integers, then the freedom to choose the integers used should permit the easy construction of smaller bimagic squares (and there is no blockage owing to the squared integers, because it is possible to construct magic squares of squares smaller than 8x8). But these small bimagic squares are incredibly difficult to construct:

Smallest possible bimagic squares: 5x5 or 6x6?

Below are the best known squares. All of them (excluding the second 5x5 example) are at least semi-bimagic: all their rows and all their columns are bimagic. The difficulty is to succeed to get also two bimagic diagonals... If you have interesting results, send me a message! I will be pleased to add your results to this page.

3rd or 4th-order bimagic square using distinct integers?

Edouard Lucas proved in 1891 that a 3rd-order bimagic square using distinct integers cannot exist (see here for more details). I have published a very short proof in my M.I. article that even a 3rd-order semi-bimagic square is not possible, "semi" meaning that only sums of rows and columns are needed, not taking account of the diagonals.

Luke Pebody and Jean-Claude Rosa proved in 2004 that it is impossible to construct a 4th-order bimagic square using distinct integers (see here for more details). This means that it is impossible to construct a 4th-order square having 20 correct sums. But it is interesting to know what the best possible 4th-order square is. My best result is the following square with 17 correct sums out of 20: only 3 bad sums. It is the CB8 square published in the M.I. article.

See also this other 4th-order square: the smallest possible semi-bimagic square using distinct integers. It has 16 correct sums out of 16, because in this case only 20-4=16 sums are required, "semi" meaning that the 4 sums of the 2 diagonals are not needed.

As seen above, it is impossible to obtain 20 correct sums. But is it possible to construct a 4th-order nearly bimagic square with 18 or 19 correct sums?

In August 2009, Lee Morgenstern proved mathematically that a 4th-order magic square can't be semi-bimagic:

This proof means that it is impossible to have 18 correct sums combined as follows: 10 correct sums S1, and 8 correct sums S2 (4 rows + 4 columns). But 4th-order nearly-bimagic squares with 18 correct sums, using a different combination, are possible. Here is an example constructed by Lee, again in August 2009:

The last part of my question above remained open: is it possible to construct a 4th-order nearly bimagic square with 19 correct sums?

In August-September 2011, Lee tried to answer with these complete parametric solutions, but did not find any example with 19 correct sums:

and finally proved in June 2012 that 4th-order nearly bimagic square with 19 correct sums are impossible (text file).

5th-order bimagic square using distinct integers?

My best result is the following square with 22 correct sums out of 24: only 2 bad sums. It is the CB9 square published in the M.I. article.

The above diagonals are not bimagic. If we construct magic squares with their four lines through the centre being bimagic (= 2 bimagic diagonals + bimagic central row + bimagic central column), and with all their rows bimagic, then it seems impossible to get any other bimagic column! An example of such a square with 20 correct sums out of 24, 4 bad sums:

My feeling is that 5th-order bimagic squares do not exist. If yes, who will produce a mathematical proof?

Is it possible to construct a 5th-order bimagic square (= 24 correct sums)? Or at least a 5th-order nearly bimagic square with 23 correct sums?

If we accept non-magic squares -the two examples above are magic-, then it is possible to construct a 5th-order nearly bimagic square with 23 correct sums, as remarked by Lee Morgenstern in August 2006, giving this example with only one non-magic diagonal.

In October 2006, Lee Morgenstern searched a 5th-order "associative" bimagic square. In such a square, the sum of two symmetrical numbers around the centre is constant, as it is in the CB9 square. His conclusion: there is no 5x5 associative bimagic square using numbers all smaller than 600,000.

In July 2009, Lee succeeded in finding a 5th-order nearly bimagic square with 23 correct sums, and this time his square is magic!

We can see that the maximum integer used in the above square is 493. In August-September 2009, Gildas Guillemot, Ecole Nationale Supérieure d'Arts et Métiers (ENSAM), France, computed that there is no 5x5 bimagic square using 25 distinct integers < 500. His program ran on a PC for 14 days.

In July 2010, Michael Quist found a new 5th-order nearly bimagic square with 23 correct sums, also magic square, but with smaller integers (maximum integer = 340) and smaller magic sums than the previous square of Lee.

In July 2011, trying to find a smaller example, Gildas Guillemot computed that there is no 5x5 nearly bimagic square with 23 correct sums having all its integers < 300. He found these 5719 different squares having 22 correct sums: zipped text file of 336Kb. In his search, the squares are magic, and the bad sums are the diagonals of squared numbers. In January 2014, he recomputed these squares, found the same results, and produced a list of the 5719 squares sorted by their S1: zipped text file of 329Kb.

In November 2014, Lee Morgenstern announced that there is no 5x5 bimagic square with distinct entries using integers in the range 1 through 1500. Using his 5x5 bimagic search technique of January 2014, it took about 2 months of computer time on 4 processors to reach this result.

March 2018: first 5x5 semi-bimagic square of primes, by Nicolas Rouanet.

And what about 5th-order bimagic squares if we allow some repeated numbers? In November 2007, Michael Cohen (Washington DC, USA) submitted a paper entitled "The Order 5 General Bimagic Square" to appear in the Journal of Recreational Mathematics. In this paper now published Vol 34(2) pp107-111, 2005-2006 (but issue printed only in the second half of 2008), he poses this interesting problem:

He gives a square having 5 sets of numbers. I sent him a slightly better square having 6 sets of numbers. In his square, this set {1, 5, 9, 9, 16} uses the number 9 twice. In my alternative square, the numbers are distinct within each set: {4, 9, 18, 26, 28}, {4, 10, 17, 24, 30}, {1, 12, 22, 24, 26}, {9, 10, 12, 20, 34}, {1, 16, 18, 20, 30}, {4, 9, 20, 22, 30}. Who will construct a bimagic square using more than 6 sets of numbers (distinct numbers within each set)?

In March 2017, Frank Rubin, author of, did not find more than 6 sets, but found another example with 6 sets. His example can be obtained from my above square, replacing 1->35, 4->28, 9->47, 10->21, 12->24, 16->12, 17->29, 18->43, 20->42, 22(center)->15, 24->54, 26->7, 28->10, 30->3, 34->1:

And also in March 2017, just for fun because not useful in N, I constructed this 5x5 fully bimagic square example in Z/41Z (or if you prefer modulo 41) using 25 distinct integers!

6th-order bimagic square using distinct integers?

--- 1) 1894. 6th-order nearly bimagic square by G. Pfeffermann, 26 correct sums out of 28, two bad sums.

--- 2) 2005. I constructed a better 6th-order square, with 27 correct sums out of 28, only one bad sum:

--- 3) Is it possible to construct a 6th-order bimagic square (= 28 correct sums)? YES!

Jaroslaw Wroblewski (Wroclaw 1962 - )
Photo during the "LIII Olimpiada Matematyczna" of Poland, in 2002. Click on the image to enlarge it.

2006, February 4th: Jaroslaw Wroblewski, University of Wroclaw, Poland, was the first to construct a 6th-order bimagic square, 28 correct sums out of 28. An important result: before him, nobody had succeeded in constructing a bimagic square smaller than the classical 8th-order bimagic squares first built in 1890!

Structured as most of the other squares of this page, Wroblewski's square is "associative": the sum of two symmetrical numbers around the centre is constant. His square is announced as the smallest possible 6th-order associative bimagic square.

After that square with (MaxNb, S1, S2) = (135, 408, 36826), he found three bigger 6th-order associative bimagic squares: (205, 618, 86978), (215, 648, 86684), (237, 714, 111074).

--- 4) A next possible step? Because Jaroslaw Wroblewski tried to find associative squares, his above smallest square was perhaps not the smallest possible 6th-order bimagic square. Hence, this new question: is it possible to construct a smaller 6th-order bimagic square, with MaxNb<135, or S1<408, or S2<36826? (with another structure, or without any structure)

Walter Trump searched for 6th-order symmetrical left/right bimagic squares: no solution with any MaxNb < 192.

In May 2006, immediately after his 7th-order bimagic squares, Lee Morgenstern found two better 6th-order squares than Wroblewski's squares: (72, 219, 10663) and (109, 330, 26432). He used unusual structures. Look at his best example below: in the two columns on the left, two cells of the same colour have the same sum 73. Not coloured below, but exactly the same structure in the two central columns, and in the two right columns.

Lee Morgenstern used another unusual structure in his other 6th-order bimagic square.

Is it possible to construct a smaller 6th-order bimagic square, with MaxNb<72, or S1<219, or S2<10663?

In October 2008, Lee Morgenstern finished his exhaustive search: there is no solution with MaxNb<72, which means that his above square can't be beaten! But the minimum S1 and S2 are still open questions.

And in July 2009, after several months of computation using up to 8 processors, Lee Morgenstern concluded that his solution has also the smallest S1 and the smallest S2. His square above is THE smallest possible 6th-order bimagic square. Thus, the answer to the above question is no!

March 2018: first 6th-order semi-bimagic square of primes, by Nicolas Rouanet.

7th-order bimagic square using distinct integers?

--- 1) 2005. My best result was the following square with 31 correct sums out of 32: only one bad sum.

It is interesting to note that this square is very nearly a normal magic square. The 49 integers used are from 1 to 55, which means only six integers missing. This square does not use consecutive integers, but is not far off!

--- 2) Is it possible to construct a 7th-order bimagic square (=32 correct sums)? YES!

2006, May 9th: competing with Frank Rubin, who had found another square with 31 correct sums, Lee Morgenstern constructed the first known 7th-order bimagic square, 32 correct sums. From May 9th to May 25th, Lee Morgenstern found a total of eight squares! His best one, with the smallest sums and numbers, is the square below having (MaxNb, S1, S2) = (67, 238, 10400). It has very unusual symmetries, the colored squares or rectangles being inside associative: the sum of two opposite numbers is constant = 68 = twice the central number of the square.

Lee Morgenstern is a retired mathematician living in Los Angeles, California, USA. He now solves puzzles as a hobby. He is a winner of some of Frank Rubin's contests at, and has solved some of Rubin's harder puzzles. In 1989, when he was living in Sylmar, California, he won the Tangles Town USA Puzzle Contest organized by the Los Angeles Times.

Among its 8 squares: 5 use this symmetry, 2 use another unusual symmetry, and 1 is an associative square (69, 245, 11483).

Is it possible to construct a smaller 7th-order bimagic square, with MaxNb<67, or S1<238, or S2<10400?

March 2018: first 7th-order semi-bimagic square of primes, with one bimagic diagonal, by Nicolas Rouanet.

Return to the home page