Search method to find 4x4 magic squares of cubes
by Lee Morgenstern, April 2013.

Here is an expanded and more detailed description of a method previously sent to find 4x4 magic squares of cubes. This is a two-phase method for finding 4x4 magic squares of cubes.

• The first phase uses a construction formula to compute 12 of the 16 entries using a Taxicab(3) solution.
• The second phase uses elliptic curves to fill in the remaining 4 entries.

2 of the remaining 4 entries can always be filled in an infinite number of ways producing 4x4 magic squares of 14 cubes. The objective is finding a particular solution where the last 2 entries are also cubes.

Phase One.

Find any Taxicab(3) solution.

A^3 + B^3  =  C^3 + D^3  =  E^3 + F^3.

There are two types of Taxicab(3) solutions, a primitive type and a specially scaled type.

---------- First Taxicab(3) type, using a primitive solution. Example.

A = 167, B = 436,
C = 228, D = 423,
E = 255, F = 414.

Place the following 12 products into the magic square.

--    (BF)^3  (AE)^3    --
--    (BE)^3  (AF)^3    --
(DF)^3  (AC)^3  (BC)^3  (DE)^3

6 of the 10 lines will have all four of its entries filled and will each have a magic sum of (A^3 + B^3)^2.

Using the example values yields

(228x255)^3  (167x423)^3  (436x423)^3  (228x414)^3
P^3      (436x414)^3  (167x255)^3      R^3
Q^3      (436x255)^3  (167x414)^3      S^3
(423x414)^3  (167x228)^3  (436x228)^3  (423x255)^3

with a magic sum of (167^3 + 436^3)^2  =  7,663,132,370,983,761 and P,Q,R,S to be determined.

---------- Second (usually better) Taxicab(3) type, using a scaling of two Taxicab(2) solutions having a common ratio.

A^3 + B^3 = C^3 + D^3
E^3 + F^3 = G^3 + H^3
where C/D = G/H so that CH = DG.

Scale each solution,

(AG)^3 + (BG)^3 = (CG)^3 + (DG)^3
(CE)^3 + (CF)^3 = (CG)^3 + (CH)^3

producing the Taxicab(3) solution,

(AG)^3 + (BG)^3 = (CE)^3 + (CF)^3 = (CG)^3 + { (CH)^3 or (DG)^3 }

Place the following 12 products into the magic square.

(CGCE)^3  (AGCH)^3  (BGCH)^3  (CGCF)^3
--     (BGCF)^3  (AGCE)^3     --
--     (BGCE)^3  (AGCF)^3     --
(DGCF)^3  (AGCG)^3  (BGCG)^3  (DGCE)^3

Divide out the common factor, CG.

(CE)^3  (AH)^3  (BH)^3  (CF)^3
--    (BF)^3  (AE)^3    --
--    (BE)^3  (AF)^3    --
(DF)^3  (AG)^3  (BG)^3  (DE)^3

The magic sum will be (A^3 + B^3)(E^3 + F^3).

Example.

A = 9  B = 15
C = 2  D = 16
E = 99 F = 276
G = 35 H = 280
with CH = DG = 560

produces

(2x99)^3   (9x280)^3  (15x280)^3  (2x276)^3
--      (15x276)^3    (9x99)^3     --
--       (15x99)^3   (9x276)^3     --
(16x276)^3    (9x35)^3   (15x35)^3  (16x99)^3

which also happens to be scaled by 3^3, so dividing by 3^3 yields

66^3    840^3  1400^3  184^3
P^3    1380^3   297^3   R^3
Q^3     495^3   828^3   S^3
1472^3    105^3   175^3  528^3

with a magic sum of 3,343,221,000 and P,Q,R,S to be determined.

Note that these numbers are smaller than the ones produced by the primitive solution.  This is typical.

Phase Two.

Solve for P,Q,R,S.

For both Taxicab(3) types, this requires

P^3 + Q^3 = (DE)^3 + (CF)^3
R^3 + P^3 = (BE)^3 + (AF)^3
S^3 + Q^3 = (AE)^3 + (BF)^3
R^3 + S^3 = (CE)^3 + (DF)^3

For the second example, this requires

P^3 + Q^3 = 528^3 +  184^3
R^3 + P^3 = 495^3 +  828^3
S^3 + Q^3 = 297^3 + 1380^3
R^3 + S^3 =  66^3 + 1472^3

We know that if a number is expressible as the sum of two cubes, then it is also expressible in an infinite number of ways as the sum of two rational cubes.  Each way corresponds to a rational point on an elliptic curve.

Rational values for P,Q,R,S are sufficient because we can scale everything by a common denominator to produce an integer solution.

Given P^3 + Q^3 = N, use the rational substitution

x =       (12N) / (P+Q)
y = 3(P-Q)(12N) / (P+Q)

so that

P = (36N + y) / (6x)
Q = (36N - y) / (6x)

and get the birationally equivalent elliptic curve

y^2 = x^3 - 432(N^2).

Since we have one point on the elliptic curve, P' = DE, Q' = CF, we can use chord/tangent arithmetic to produce other points.

For each P, Q solution, compute R and S using

R^3 = (BE)^3 + (AF)^3 - P^3
S^3 = (AE)^3 + (BF)^3 - Q^3

making sure that R and S are rational, and then verify that

R^3 + S^3 = (CE)^3 + (DF)^3.

In the second example, another rational solution is

P^3 + Q^3 = 528^3 + 184^3 = (13152/31)^3 + (13192/31)^3.

Scaling by 31^3, yields the 14-cube magic square

2046^3   26040^3  43400^3     5704^3
13152^3   42780^3   9207^3  18,249,569,498,449
13192^3   15345^3  25668^3  76,777,570,970,855
45632^3    3255^3   5425^3    16368^3

with magic sum = 99,597,896,811,000.

Note

In Phase One, if you rearrange the values of the Taxicab(3) solution, making a different assignment for E and F, you will get a different combination of values to satisfy the P,Q,R,S requirement.  There are three inequivalent ways this can be done.

So each Taxicab(3) solution produces three chances to find a magic square of 16 cubes.