Latest research on the "3x3 magic square of squares" problem

This page presents the most interesting studies on the Open problems 1 and 2 done after the publication of my article "Some notes on the magic squares of squares problem" in 2005. The two corresponding prizes are still to be won!

• \$100 prize offered by Martin Gardner since 1996, on problem 1
• 1,000 prize + a bottle of champagne since 2010 (was only 100 from 2005 to 2009), on my "easier" sub-problem 2 = enigma 1

If you want to study these two problems, I STRONGLY recommend that you first:

• read the above Mathematical Intelligencer paper,
• read these 5 earlier references (download the 5 PDF files from  to ): + Christian Boyer, + Andrew Bremner,  Duncan Buell
• read also  Landon Rabern's paper and below improvements by Lee Morgenstern on 3x3 magic squares of squares properties
• see the PowerPoint presentation summarizing the paper and the above references < 2005
• and, of course, read the latest results in this page! From Ajai Choudhry, Randall Rathbun, Jean-Claude Rosa, Lee Morgenstern, Lucien Pech, Landon Rabern, Frank Rubin, Lee Sallows, Ant King, Mike Winkler, Tim S. Roberts, Mark Underwood, Paul Zimmermann, Paul Pierrat, FranÓois Thiriet, Terry Moriarty, Eddie Gutierrez, Matt Parker with Brady Haran, Ben Asselstine, Christian Woll, Joseph Hurban, Adrian Suter, Benjamin Bartsch, Giancarlo Labruna, Vlad Volosatov, Arkadiusz Wesolowski, Onno Cain, Sunil Kumar.

Ajai Choudhry, India, constructed some 3x3 squares with 7 correct sums, their magic sums not being a square. For example:

 7656ý 14543ý 16764ý 18127ý 14916ý 264ý 12804ý 10824ý 16433ý

Interesting, because most of the 3x3 squares with 7 correct sums come from the Lucas family, in which the magic sum is a square. The first known example with a non-square magic sum was constructed by Michael Schweitzer (Fig MS4 of the M.I. article). It would be very interesting to find a parametric solution with a non-square magic sum, generating an infinite number of 3x3 squares. With such a new parametric solution, it should be easy to check mathematically if this family can or cannot produce a solution with 8 magic sums. The Lucas family is unfortunately proved unable to produce 8 magic sums.

Message from Randall Rathbun, USA, on the Open problem 2:

"I wore out the meccah high speed calculation cluster at Harvard University trying, but no success. Spent weeks running the code, but nothing more turned up than the 1 example that Dr Andrew Bremner found.
Quite discouraging, actually"

Several years before this problem 2, Randall already worked on Gardner's challenge (=our open problem 1). It was in 1999, look at:

Received November 5th, 13th, 23rd, 2006
Jean-Claude Rosa, France, constructed this 3x3 semi-magic square (with 6 correct sums) using only odd numbers. Interesting, because most of the 3x3 semi-magic squares use both odd and even numbers. Strange: in this smallest possible example, all the numbers used are squares of primes.

 11ý 23ý 71ý 43ý 59ý 19ý 61ý 41ý 17ý

Using these 3 primitive Pythagorean triangles having the same area:

• 1380ý + 19019ý = 19069ý
• 3059ý + 8580ý = 9109ý
• 4485ý + 5852ý = 7373ý

he constructed this 3x3 square (with 7 correct sums) using only odd numbers. 6 of its 9 numbers are squares of primes.

 5521ý 10337ý 19069ý 20399ý 9109ý 1367ý 7373ý 17639ý 11639ý

And using other Pythagorean triangles having the same area, he produced this other square (with 7 correct sums) using only odd numbers. The magic sum is smaller than the previous square.

 14393ý 2171ý 13507ý 12181ý 10517ý 11633ý 6227ý 16703ý 8749ý

Theorem from Lee Morgenstern, USA: "In a 3x3 magic square of distinct squares, the smallest square cannot be 1."

Only some days after Lee Morgenstern, Jean-Claude Rosa independently proved that a 3x3 magic square can't be constructed using 1 and eight squares of odd numbers.

From Lee Morgenstern, USA, far extending his previous proof excluding 1: "if there is a 3x3 magic square of distinct squares, then all entries must be above 10^14."

Lucien Pech, when he was a "MathÕmatiques SpÕciales" student, school year 2005-2006, chose the "3x3 magic square of squares" as the subject for his TIPE: Travaux d'Initiative Personnelle EncadrÕs = supervised personal search. He searched for a magic hourglass; such a solution would solve the Open problem 2, since it uses 7 squares. He used Duncan Buell's method (see reference , top of this page), but didn't find any solution to this very difficult problem. His best result is an excellent modulo 2^52 example, better than Duncan Buell's modulo 2^46 example.

Lucien Pech, now a student at the ENS Paris (Ecole Normale SupÕrieure, rue d'Ulm), sent this revised version of his TIPE:

After his paper published in 2003  on the magic squares of squares problem, Landon Rabern, USA, searched for a 3x3 magic square having at least 7 squared integers. Using a similar method as my study of 2004 , he didn't find any new example different from the only known example.

You can download and use his Windows application with any other range of center cells, even though he doesn't provide any explanation on its use (unfortunately): http://landon314.brinkster.net/MagicSearcher.zip. This application needs the Microsoft .NET Framework. The code sources are provided.

Received April 8th and 12th, 2008.
From Lee Morgenstern, USA, the complete formula for all 3x3 semi-magic squares of squares (better than the Lucas formula producing some, but not all, 3x3 semi-magic squares of squares), and a list of 3x3 semi-magic squares with 7 correct sums and using odd entries (including the two first smallest squares given above by J.-C. Rosa in 2006):

From Lee Morgenstern, USA: "We know that the magic sum of a 3x3 fully-magic square must be three times the central entry. Are there any 3x3 semi-magic squares of squares with a magic sum of three times any square? Looking over the published results, such as with the Lucas formula, all the magic sums are squares.The new non-square magic sums that you published on your previous update weren't three times a square. I searched for 3x3 semi-magic squares of squares and found 20 of them with a magic sum that is three times a square (searched up to a magic sum of 3 x 5000ý). One of them, the smallest, had a magic sum which was three times one of the actual entries. Since you can rearrange rows and columns to make another semi-magic square, any of the entries can become the central one. So here is my 3x3 semi-magic square of squares having a magic sum which is three times the central entry (S = 3 x 1105ý). This is the only known solution."

 1751ý 155ý 757ý 595ý 1105ý 1445ý 493ý 1555ý 1001ý

For his other 19 solutions, the magic sum was three times a square different from any of the entries. Their sums (< 3 x 5000ý) are 3 x 1225ý, 1275ý, 1533ý, 1955ý, 1989ý, 2125ý, 2265ý, 2335ý, 2345ý, 2675ý, 3395ý, 3485ý, 3515ý, 3575ý, 3655ý, 3765ý, 3885ý, 3995ý, 4193ý. Here is the example S = 3 x 1225ý:

 2105ý 25ý 265ý 235ý 1877ý 961ý 125ý 989ý 1873ý

Received from May 17th to July 27th, 2009.
Frank Rubin (http://contestcen.com/) worked on 3x3 semi-magic squares of squares having 7 magic sums, only one diagonal being not magic. With Sd1 = magic sum = sum of the magic diagonal, and Sd2 = sum of the non-magic diagonal, Frank searched for squares having the best possible ratio Sd1/Sd2 ~ 1.

Using Lee Morgenstern's method for finding 3x3 nearly-magic squares of squares with close sums, here is one of the impressive squares computed by Frank Rubin:

 32004859810489663461722097429913882ý 6566314229570234516482551556735538ý 28680635830907835745130420028727601ý 20694684230850857980455894108812542ý 25099843330956651396728662500908321ý 28839804352015135412123656375760542ý 20914717277840113725279028899813359ý 34883918758013437522259135104857422ý 15352303377279966158185135232591402ý

Sd1 = 1890006405715707401173356334328966702876471825085875343146504267674569
Sd2 = 1890006405715707267778636165444057741201927206436686602706450141117123

Sd1/Sd2 = 1.0000000000000000705... Very close to 1... And Sd1/Sd2 = 1 would be a solution of this 3x3 magic square of squares problem!

Noticing that the magic sum is a square (S = Sd1 = 43474203911235768609981537098048163ý), I thought that Rubin's square was simply a member of the Lucas family.
January 22nd 2010, mentioning my feeling to
Randall Rathbun, he confirmed, finding (p, q, r, s) = (51498645679307420, 68881590670955891, 80839778471595961, 171878882029570731).
It is known that unfortunately this family can't produce a 3x3 magic square of squares.

Here is Lee Morgenstern's method, above used by Frank Rubin in May-July 2009 for 3x3 nearly-magic squares of squares with close sums. This method uses Hillyer's formula of Pythagorean Triangles having equal areas, and Newton's method of finding a root of a polynomial:

Randall Rathbun made a serious attempt to solve the enigma #1, searched for a 3x3 magic square having 7 squared entries, different from the only known example. He created more than 116,000,000 magic squares having 6 squared entries, looking to see if their 7th, 8th or 9th entries was a squared integer. But alas, no new solution!

Interesting remark by Lee Sallows on the enigma #1: it is possible to construct a 3x3 magic square having 7 squared entries, if we allow... allow from SallowS ? ;-)... Gaussian integers! Here is his nice example having a null magic sum, the two non-squared entries being 6 and -6:

 (1+2i)ý (-2+2i)ý (2+i)ý = -3+4i -8i 3+4i 6 0ý -6 6 0 -6 (-1+2i)ý (2+2i)ý (2-i)ý -3-4i 8i 3-4i

Can somebody construct a 3x3 magic square having 8 or 9 distinct squared Gaussian integers?

Here is Lee Morgenstern's method for finding 3x3 magic squares with 7 distinct square entries. This method would be (perhaps?) able to solve the enigma 1.

Ant King (www.mathstutoring.co.uk) constructed this nice parametric solution of 3x3 semi-magic squares of squares using a single variable, and only one diagonal is not magic. Because its magic sum is a squared integer [3(1+ 3k + 3ký)ý]ý, this parametric solution unfortunately can't produce magic squares of squares (needing a magic sum equaling three times a squared integer, or more precisely three times its center).

 (2 +14k + 37k2 + 42k3 +18k4)2 (−2 −8k − 7k2 + 6k3 + 9k4)2 (1+10k + 29k2 + 36k3 +18k4)2 (2 +12k + 29k2 + 30k3 + 9k4)2 (1+ 6k +19k2 + 30k3 +18k4)2 (2 +12k + 29k2 + 36k3 +18k4)2 (−1− 2k + 7k2 + 24k3 +18k4)2 (2 +16k + 43k2 + 48k3 +18k4)2 (2 +10k +19k2 +18k3 + 9k4)2

Received from November 15th 2011 to January 27th 2012
Lee Morgenstern sent various interesting remarks and results:

For example, in the last but one document, he extended the above remark of Lee Sallows on Gaussian integers.
And in the last document, he constructed a magic square of squares modulo 2^90, therefore better than previous magic hourglasses of squares by Duncan Buell and Lucien Pech (respectivelly mod 2^46 and mod 2^52).

Received March 2nd, 2012, updated May 6th, 2012, updated again August 21st, 2012
Mike Winkler (www.mikewinkler.co.nf), using Morgenstern's above remark of Feb. 2009, searched for 3x3 semi-magic squares having a magic sum which is three times a square.

His search with Delphi was done with magic sum < 3 x 320000ý, but in a non-exhaustive way. He found 7 out of the 20 solutions previously found by Morgenstern < 3 x 5000ý, and also these new bigger solutions. Sums = 3 x 6115ý, 7395ý, 8905ý, 9345ý, 9565ý, 9995ý, 10195ý, 12725ý, 13175ý, 13765ý, 14825ý, 15225ý, 15525ý, 16185ý, 18085ý, 18115ý, 20085ý, 22425ý, 25075ý, 26571ý, 28135ý, 32625ý, 37635ý, 41905ý, 41925ý, 42415ý, 44353ý, 45025ý, 45435ý, 49045ý, 63495ý, 76075ý, 77435ý, 87135ý, 117725ý, 123335ý, 124845ý, 140675ý, 141865ý, 157675ý, 195925ý, 196775ý, 227035ý, 264265ý, 319685ý. But no new solution with sum three times the central entry.

Lee Morgenstern reused his method sent in April 2008 concerning the list of 3x3 nearly-magic squares of squares having all odd entries and 7 correct sums. This is equivalent to three 3-square arithmetic progressions having equal step values. The idea was to look for instances that satisfy the requirements of a 3x3 fully-magic square of squares. The 2008 results were based on two searches:

1. All odd-entry APs, primitive and scaled, up to a step value of d = 1.4 x 10^10.
2. All primitive APs up to d = 10^19.

His new 2013 searches extended the above:

1. up to d = 2.4 x 10^19.
2. up to d = 6.4 x 10^22.

Received July 2nd and August 8th, 2013

Tim S. Roberts, Bundaberg, east coast of Australia, author of http://unsolvedproblems.org, reminds us that a 3x3 magic square of squares must have this parametric form of any 3x3 magic square:

 aý bý cý = x+y x-y-z x+z dý eý fý x-y+z x x+y-z gý hý iý x-z x+y+z x-y

As an example, we will look at the modulo 13. Any squared integer can only have one of these 7 "authorized" values, the quadratic residues mod 13: 0, 1, 3, 4, 9, 10, 12. If we check by program all the possible values (x, y, z) mod 13, the nine cells (x+y), (x-y-z), ...(x-y) can be nine squares (meaning that none of them is equal to another value than the 7 authorized values) only when (x, y, z) = (x, y, 0) or (x, 0, z): we conclude that y or z must be divisible by 13. Also equivalent is to say that y*z must be divisible by 13. Here are the final astonishing results that I have checked and slightly extended (5 -> 5^2, and 7 -> 7^2):

• y*z must be divisible by 2^6 * 3^2 * 5^2 * 7^2 * 11 * 13 * 19 * 31 = 59,430,571,200.
• x*y*z must be divisible by 59,430,571,200 * 17 * 29 * 37 = 1,084,073,049,259,200.

Yes, x*y*z must be divisible by every prime < 40, with the sole exception of 23.

Received from August 10th to September 3rd, 2013

Tim S. Roberts, again using the above parametric form of any 3x3 magic square, remarked that:

• at least one element of (x, y, z, y+z, y-z) must be divisible by 2
• at least one element of (x, y, z, y+z, y-z) must be divisible by 3
• at least one element of (x, y, z, y+z, y-z) must be divisible by 4
• and so on... at least one element must be divisible by 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 28, 29, 30, 31, 33, 34, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 47, 48, 51, 52, 53, 56, 57, 60, 61, 62, 66, 67, 68, 69,...

Astonishing! An incredibly long list, where 25 is the first integer > 1 not present. We can extend and finish his list, and say:

• at least one element of (x, y, z, y+z, y-z) must be divisible by 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 28, 29, 30, 31, 33, 34, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 47, 48, 51, 52, 53, 56, 57, 60, 61, 62, 66, 67, 68, 69, 72, 76, 78, 84, 86, 88, 92, 93, 94, 102, 104, 114, 120, 124, 129, 132, 134, 136, 138, 141, 152, 156, 168, 172, 184, 186, 188, 201, 204, 228, 248, 258, 264, 268, 276, 282, 312, 344, 372, 376, 402, 408, 456, 516, 536, 552, 564, 744, 804, 1032, 1128, 1608.

This should be the full list, a total of 106 integers. All these integers can be factorized with these primes only (or powers of them): 2 (4, 8, 16), 3 (9), 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 61, 67.
That is to say, every prime < 70, with the sole exception of 59. We can also say that:

• x*y*z*(y+z)*(y-z) must be divisible by 2^4 * 3^2 * 5 * 7 * 11 * 13 * 17 * 19 * 23 * 29 * 31 * 37 * 41 * 43 * 47 * 53 * 61 * 67 = 3196605376710617107476240.

Received from December 18th 2013 to January 8th, 2014

Mark Underwood, Canada, sent to Tim S. Roberts an interesting remark improving the above results: y and z must both be divisible by 24, then so too must be y+z and y-z. So the product of all four must be divisible by 24^4, which is 2^12 * 3^4. And at least one of the items must be divisible by 16, and at least one by 9. So that brings it up to 2^13 * 3^5.

And if I add my previous remark of July-August 2013 that y*z must be divisible by 5^2 * 7^2, then:

• x*y*z*(y+z)*(y-z) must be divisible by 2^13 * 3^5 * 5^2 * 7^2 * 11 * 13 * 17 * 19 * 23 * 29 * 31 * 37 * 41 * 43 * 47 * 53 * 61 * 67 = 1546645545467664981281303961600.
Divisible by an integer as big as ~ 1.5 * 10^30...

Received February 7th and 22nd, 2014

Lee Morgenstern extended again his previous searches of January 2013 and April 2008. No solution :

1. up to d = 2.4 x 10^21.
2. up to d = 6.0 x 10^23, the primitive step values being 4mn(mý-ný), with m,n coprime, one odd, one even, and n < m < 2^24.

Lee Morgenstern completed three new searches for a magic hourglass, but found no solution. Not a search... but a call to search for a 3x3 magic square of squares in an article in Scientific American's website. Thanks to Ricki Rusting, Managing Editor, for mentionning my name, linking to multimagie.com http://www.scientificamerican.com/article/can-you-solve-a-puzzle-unsolved-since-1996

Received from February 19 to March 13, 2015

Paul Zimmermann, researcher (INRIA, LORIA, http://www.loria.fr/~zimmerma/), with two young students, Paul Pierrat and FranÓois Thiriet, proved these modular properties: the magic sum of any primitive 3x3 magic square of squares must be 3 mod 72, and the squared entries must be 1 mod 24. And extending Buell's and Pech's previous searches, they found modulo 2^n solutions for 3x3 magic squares of 7 squares, up to modulo 2^59.

Their paper is available at http://www.loria.fr/~zimmerma/papers/squares.pdf

Terry Moriarty, Northern Ireland, found some properties of 3x3 magic squares of squares. For example, their magic sums are 3 mod 72. Look at http://magicsqr.byethost8.com/

Allowing imaginary numbers (see also above), Eddie Gutierrez, New Jersey, USA, found 3x3 magic squares having 7 squared entries. For example, this square with magic sum = 15552:

 113ý (121i)ý 132ý = 12769 -14641 17424 9839 72ý 23ý 9839 5184 529 (84i)ý 25009 (49i)ý -7056 25009 -2401

Look at http://www.oddwheel.com/, with some other studies. The above magic square can be found from his table of contents 0B, 15th page (or directly http://www.oddwheel.com/Image_SquareA.html)

F U N !!! Matt Parker, an Australian living in UK, former maths teacher (https://en.wikipedia.org/wiki/Matt_Parker and http://standupmaths.com/), tried to solve the enigma #1 (3x3 magic square of squares) at (YouTube Numberphile videos by Brady Haran). In his video, 1:02-1:36, he also presented the solution of the enigma #4c (7x7 magic square of cubes) found in 2015 by SÕbastien Miquel:

Invalid solution..., so no, I did not send any prize in euros or any bottle of champagne to Matt! :-)

Received February 6 and March 1, 2017

Ben Asselstine, Canada, announced his "set of tools for finding and managing 3x3 magic squares of squares" freely available at http://fituvalu.nongnu.org/. This software uses libgmp (GNU Multiprecision Arithmetic Library) for computing on large integers, and is designed to be easily parallelizable with GNU Parallel.

He added this javascript program http://fituvalu.nongnu.org/checker.html: "It lets people check their 3x3 magic squares with 6 or more (?) perfect squares against a list of 100,000 known squares."

Lee Morgenstern sent PDFs of two articles written a few years ago, updated versions of the broken links of 2006 :

Lee Morgenstern produced this 3x3 square, using the new 6th triple of primitive Pythagorean triangles having equal areas found by Duncan Moore a few days earlier:

 19720769947309ý 6757561171393ý 11290071470263ý 10987237357337ý 9483582546853ý 18745169816089ý 7239541562993ý 20650330341071ý 9120965347253ý

S = 562039114103450691451191099 for rows, columns, and one diagonal. Unfortunately the other diagonal has a different sum.

Received from March 11 to 13, 2017

Randall Rathbun, USA, found the elliptic curve of rank 4

• y2 = x3 - x2 + 7528505392x + 671534074163712

giving the only previously known example with 7 squared entries. An excellent work, because it is very difficult to find this curve. But unfortunately, thousands of points on this curve (producing numbers with thousands of digits!) did not produce any other magic square with 7 squared entries...

Details in the emails sent by Randall to Andrew Bremner and me.

Christian Woll, California, USA, sent an interesting paper entitled "The Magic Hourglass of Squares related to the Gaussian Integers"

Joseph Hurban, when he was student tutor at TCNJ (College of New Jersey, USA), sent this nice formula producing 3x3 magic squares of 5 squares:

 (10zý + 20z + 5)ý b = 7ý(2zý + 1)ý - 4z(2zý + 101z + 1) c = (2zý + 1)ý + 8z(26zý + 38z + 13) (2zý + 2z + 1)ý (10zý + 10z + 5)ý (14zý + 14z + 7)ý g = 7ý(2zý + 1)ý + 8z(24zý - 13z + 12) h = (2zý + 1)ý + 4z(102zý + 151z + 51) (10zý - 5)ý

Is it possible to obtain supplemental squared integers in cells b, c, g, and h? With a MATLAB program, he tried to find solutions, and from z = 0 to 1,000,000, found five solutions:

• z = 0 : b, c, g, h are squared integers, but the solution does not use unique integers
• z = 1 : b, c, g, h are squared integers, but the solution does not use unique integers
• z = 3 : c = 95ý, producing a 3x3 magic square of 6 squares
• z = 10: c = 529ý, producing a 3x3 magic square of 6 squares
• z = 12 : h = 937ý, producing a 3x3 magic square of 6 squares

Examples with z = 1, 2, 3:

 35ý 5ý 25ý 85ý 2281 3169 155ý 13825 95ý 5ý 25ý 35ý 13ý 65ý 91ý 25ý 125ý 175ý 25ý 35ý 5ý 5281 6169 35ý 22225 17425 85ý

I checked that there is no other solution with more than 5 squared integers for any z < 10^10.

Adrian Suter, Switzerland, working on Moriarty's results, sent a paper unfortunately producing a 3x3 magic square of non-distinct squares...

Benjamin Bartsch sent this parametric solution, similar to King's solutions, producing 3x3 semi-magic squares:

 (-2 - 6x - 7x2 - 2x3 - x4)2 (-2 + 5x2 + 4x3 + 2x4)2 (-1 - 6x - 5x2 - 4x3 - 2x4)2 (-2 - 4x - 5x2 + 2x4)2 (-1 - 2x - 7x2 - 6x3 - 2x4)2 (-2 - 4x - 5x2 - 6x3 - x4)2 (1 - 2x - 7x2 - 8x3 - 2x4)2 (-2 - 8x - 7x2 - 2x3 + x4)2 (2 + 2x + x2 + 2x3 + 2x4)2

Seven magic lines with S = 9 + 36x + 90x2 + 144x3 + 171x4 + 144x5 + 90x6 + 36x7 + 9x8, one diagonal being not magic with a different sum.

I remarked that with x = -8.6131187, we have a fully magic square with eight magic lines.... but of course using non-integers :-)

Two years after his magic squares of 7 squares allowing imaginary numbers, Eddie Gutierrez found a new 3x3 magic square of 7 squares, this time linked to Bremner's square (www.oddwheel.com/special squares.html), S = 780300:

 806425 (697i)ý 678ý = 806425 -485809 459684 -86641 510ý 779ý -86641 260100 606841 246ý 1003ý (535i)ý 60516 1006009 -286225

Thesis, May 2018

Giancarlo Labruna, Montclair State University (New Jersey, USA), submitted a thesis entitled "Magic Squares of Squares of Order Three over Finite Fields". Giancarlo is now lecturer, School of General Studies, Kean University (New Jersey).

Published from September to November 2018

Christian Woll, after his above paper of June 2017, published two new papers on arXiv:

Two examples of his Lunar magic squares of squares. On the left in base 10, S = 24ý. On the right in base 2, S = 1011111.

 22ý 0ý 14ý 11ý 101ý 1001ý 1ý 24ý 2ý 110ý 1011ý 1ý 4ý 3ý 23ý 1010ý 0ý 111ý

On Lunar arithmetic, and primes on the Moon, Numberphile video featuring Neil Sloane (OEIS): https://youtu.be/cZkGeR9CWbk, Nov. 2018.   Lunar addition, Lunar multiplication, and Neil Sloane

Vlad Volosatov, Russia, cleverly remarked that 3x3 magic squares of squares are possible using quaternions (iý = jý = ký = ijk = -1). For example, with S = -75 :

 (5i)ý (7k)ý (j)ý = -25 -49 -1 (k)ý (5j)ý (7i)ý -1 -25 -49 (7j)ý (i)ý (5k)ý -49 -1 -25

I add a remark: there is already a link between quaternions and 4x4 magic squares of squares!

Arkadiusz Wesolowski, Poland, found two parametric solutions of 3x3 magic squares of 5 squared integers. With n >= 1, let

• x = -1 + [(sqrt(2)/2)*((3 + 2*sqrt(2))n - (3 - 2*sqrt(2))n) + (3 + 2*sqrt(2))n + (3 - 2*sqrt(2))n)]/2

Or equivalent, the value of x can also be obtained with this recurrence formula:

• x = a(n) = 6*a(n-1) - a(n-2) + 4, starting with a(0) = 0 and a(1) = 4

Then we obtain this magic square, the integers in black being squared integers:

 17x4 + 44x3 + 34x2 + 10x + 1 9x2 + 6x + 1 10x4 + 28x3 + 23x2 + 8x + 1 2x4 + 8x3 + 11x2 + 6x + 1 9x4 + 24x3 + 22x2 + 8x + 1 16x4 + 40x3 + 33x2 + 10x + 1 8x4 + 20x3 + 21x2 + 8x + 1 18x4 + 48x3 + 35x2 + 10x + 1 x4 + 4x3 + 10x2 + 6x + 1

First examples with n = 1 (-> x = 4) and n = 2 (-> x = 28):

 7753 13ý 4753 11441977 85ý 6779473 35ý 65ý 85ý 1189ý 2465ý 3277ý 3697 91ý 697 5372977 3485ý 710473

The other parametric solution is a derivative of the first one above. Again with n >= 1:

• x = 1 + [(sqrt(2)/2)*((3 + 2*sqrt(2))n - (3 - 2*sqrt(2))n) + (3 + 2*sqrt(2))n + (3 - 2*sqrt(2))n]/2
• or x = a(n) = 6*a(n-1) - a(n-2) - 4, starting with a(0) = 2 and a(1) = 6

•  17x4 - 44x3 + 34x2 - 10x + 1 9x2 - 6x + 1 10x4 - 28x3 + 23x2 - 8x + 1 2x4 - 8x3 + 11x2 - 6x + 1 9x4 - 24x3 + 22x2 - 8x + 1 16x4 - 40x3 + 33x2 - 10x + 1 8x4 - 20x3 + 21x2 - 8x + 1 18x4 - 48x3 + 35x2 - 10x + 1 x4 - 4x3 + 10x2 - 6x + 1

First examples with n = 1 (-> x = 6) and n = 2 (-> x = 30):

 13693 17ý 7693 12612301 89ý 7364461 35ý 85ý 115ý 1189ý 2581ý 3451ý 6757 119ý 757 5958661 3649ý 710821

In the two parametric solutions, the numbers increase quickly: i.e. with n = 100, the magic sums are as big as ~2.38*10^307... However maybe, for some values of n, cells in red can become (huge) squared integers, giving 3x3 magic squares with more than 5 squared integers?

Onno M. Cain, USA, worked on a paper, later published in August 2019 on arXiv, entitled "Gaussian Integers, Rings, Finite Fields, and the Magic Square of Squares".

And, after Woll's paper on 3x3 magic squares of squares on the Moon, Onno constructed this 3x3 magic square of squared Lunar primes:

 1001101ý 110101ý 1010011ý 111001ý 1010111ý 1011001ý 1001011ý 1011101ý 1001111ý

His papers (including this square) are available at https://sites.google.com/view/onnomc/papers, and his software for Lunar Arithmetic calculations in Python is also available at https://github.com/onnomc/lunar-arithmetic-wrapper and https://repl.it/@onnomc/LunarArithmeticPlayground

Ben Asselstine published a PDF of 41 pages, looking as a PowerPoint file, on the 3x3 magic square of squares problem, including his analysis on magic squares of 6 squares.

Sunil Kumar, Tamil Nadu, India, 16 years old, found this near-miss of a 3x3 magic square of 7 squares, S = 108329642031:

 65118629677 49565ý 201877ý 108377ý 190026ý + 1 245915ý 177385ý 264127ý 7101131677

Received December 20 and 22, 2019

One year after his above parametric solutions of 3x3 magic squares of 5 squared integers, one more squared integer! Arkadiusz Wesolowski found this marvelous parametric solution of 3x3 magic squares of 6 squared integers:

• x = [(3 + sqrt(3))*(2 + sqrt(3))n+1 + (3 - sqrt(3))*(2 - sqrt(3))n+1]/6,
• y = [(3 + sqrt(3))*(2 + sqrt(3))n + (3 - sqrt(3))*(2 - sqrt(3))n]/6,
• z = 2n * [(1 + sqrt(3)/2)n+1 - (1 - sqrt(3)/2)n+1]/sqrt(3).
 (xy - z)ý (xz + y)ý xý + yýzý (x + yz)ý (xý + yý)(zý + 1)/2 (xz - y)ý xýzý + yý (yz - x)ý (xy + z)ý

The three first examples of 3x3 magic squares, constructed with n = 1 (-> (x, y, z) = (11, 3, 4)), n = 2 (-> 41, 11, 15), and n = 3 (-> 153, 41, 56):

 29ý 47ý 265 436ý 626ý 28906 6217ý 8609ý 5295025 23ý 1105 41ý 206ý 203626 604ý 2449ý 39353665 8527ý 1945 1ý 37ý 378346 124ý 466ý 73412305 2143ý 6329ý

When n is an even positive number, we can prove that the cells in red can't be squared integers. His quick search of odd n <= 2*10^5 didn't produce 3x3 magic squares with seven, eight, or nine square numbers. But maybe a larger odd n?

This was not given by Arkadiusz, but x, y, z can be easily computed with these recurrence formulas:

• x(0) = 3
• y(0) = 1
• z(0) = 1
• x(n) = 3*x(n-1) + 2*z(n-1)
• y(n) = x(n-1)
• z(n) = x(n-1) + z(n-1)

And less than one month later, Arkadiusz Wesolowski found another marvelous parametric solution of 3x3 magic squares of 6 squared integers. The following identity expresses the product of two sums of two squares as a sum of two squares in three different ways.

• [(6n2 + 6n + 2)2 + (2n + 1)2] * [(3n2 + 2n)2 + (3n2 + 4n + 1)2]
= (18n4 + 48n3 + 43n2 + 16n + 2)2 + (18n4 + 24n3 + 7n2 - 2n - 1)2
= (18n4 + 42n3 + 37n2 + 14n + 2)2 + (18n4 + 30n3 + 19n2 + 6n + 1)2
= (18n4 + 36n3 + 29n2 + 10n + 1)2 + (18n4 + 36n3 + 29n2 + 12n + 2)2

And since

• 2 * (18n4 + 42n3 + 37n2 + 14n + 2)2 = (18n4 + 48n3 + 43n2 + 16n + 2)2 + (18n4 + 36n3 + 29n2 + 12n + 2)2

we can form a magic square with:

• w = 6ný + 6n + 2,
• x = 2n + 1,
• y = 3ný + 2n,
• z = 3ný + 4n + 1.
 (wz + xy)ý (wy - xz)ý (2yý - zý)xý + (2zý - yý)wý 2(xýyý + wýzý) - (wy + xz)ý xýyý + wýzý (wy + xz)ý xýzý + wýyý 2(xýyý + wýzý) - (wy - xz)ý (wz - xy)ý

The three first examples of 3x3 magic squares, constructed with n = 1, 2, 3:

 127ý 46ý 20062 878ý 503ý 905719 3191ý 2162ý 11588158 16702 113ý 94ý 778039 802ý 713ý 10220638 2969ý 2722ý 74ý 23422 97ý 617ý 1033399 718ý 2458ý 12955678 2729ý

I checked that the cells in red are not squared integers for any n < 10^10, meaning magic sum < 9.72*10^82. So difficult to obtain a 7th squared integer! But maybe possible for a larger n ?

Three years after his first parametric solution, Joseph Hurban sent this nice parametric solution of 3x3 magic squares of 4 squared integers:

 (qr - ps)ý [(qr)ý + (ps)ý + (pr)ý + (qs)ý]/2 + 4pqrs (pr - qs)ý [3(pr)ý + 3(qs)ý - (qr)ý - (ps)ý]/2 [(qr)ý + (ps)ý + (pr)ý + (qs)ý]/2 [3(qr)ý + 3(ps)ý - (pr)ý - (qs)ý]/2 (qr + ps)ý [(qr)ý + (ps)ý + (pr)ý + (qs)ý]/2 - 4pqrs (pr + qs)ý

We can obtain a lot of solutions with two more squared integers, but again it is very difficult to obtain a 7th... Here are two examples of solutions with 6 squared integers, obtained with (p, q, r, s) = (1, 3, 2, 11) and (1, 9, 5, 8):

 5ý 889 31ý 37ý 5089 67ý 1561 25ý -311 6769 3649 23ý 17ý 19ý 35ý 53ý 47ý 77ý

Before sending me your results, don't reinvent the wheel!
Read the top of this page. For example, yes, the below results are well known and proved, do not send them again.

If a 3x3 magic square of 9 squared integers exist (primitive, with cells relatively prime), then all cells are odd, and all cells are 3k+1
-> all cells are 6k+1.
And no cell multiple of 3, 11, 19, 43,... because already proved are:
1) the center cell is a (squared) product of 4k+1 prime numbers = 5, 13, 17, 29, 37, 41,...
2) the 4 cells middle-side are (squared) products of 8k+1 and/or 8k+7 prime numbers = 7, 17, 23, 31, 41, 47,...
3) the 4 corners are (squared) products of 8k+1, +5, and/or +7 prime numbers = 5, 7, 13, 17, 23, 29, 31, 37, 41, 47,...

In a 3x3 magic square of 9 squared integers, if we accept that some squared integers can be repeated, then any solution uses only 1 or 3 squared integers.
No other way, impossible with 2, 4, 5, 6, 7, or 8 distinct squared integers. But unknown for 9, that's the problem...
On the left, the only possible family of solutions with repeated squared integers.

 3x3 magic square of squares, S = 3cý,with aý + bý = 2cý Obvious 3x3 magic square of squares, S = 3,constructed with (a, b, c) = (1, 1, 1) 3x3 magic square of squares, S = 75,constructed with (a, b, c) = (1, 7, 5) aý bý cý 1ý 1ý 1ý 1ý 7ý 5ý bý cý aý 1ý 1ý 1ý 7ý 5ý 1ý cý aý bý 1ý 1ý 1ý 5ý 1ý 7ý