Office Applications and Entertainment, Magic Squares  Index About the Author

16.0   Special Magic Squares, Squares of Squares

In contradiction to Bimagic Squares, as discussed in previous section, Magic Squares of Squares are not magic when its entries are not squared.

16.1   Squares of Squares (3 x 3)

Up to now (Jan. 2016), nobody has been able to construct a 3th order Magic Square of Squares, nor proven that it is impossible to construct such a square.

Semi Magic Squares have been developed over the centuries and discussed in many papers.

This section describes a few of these methods and illustrates also how Semi Magic Squares of Squares can be found by means of Conditional Sequential Searching.

16.1.1 Semi Magic, Edouard Lucas, Six Magic Lines

The first example of a Semi Magic Square of the 3th order, as published by Eduoard Lucas in 1876, was based on following formula’s:

 (p2 + q2 – r2 – s2)2 [2(qr + ps)]2 [2(qs – pr)]2 [2(qr – ps)]2 (p2 – q2 + r2 – s2)2 [2(rs + pq)]2 [2(qs + pr)]2 [2(rs – pq)]2 (p2 – q2 – r2 + s2)2

as described in an article published by Christian Boyer in The Mathematical Intelligencer (Vol. 27, N. 2, 2005, pages 52-64).

The 3 rows and 3 columns sum to the Magic Sum s1 = (p2 + q2 + r2 + s2)2.

Attachment 16.1.1 shows the occurring Magic Sums and corresponding distinct variable values {ai2} while varying the parameters p, q, r and s over the range {1 ... 8}.

Based on these data, 2304 (= 32 * 72) Semi Magic Squares with six Magic Lines of the Lucas Family could be found.

Attachment 16.1.2 shows one (occasionally two) unique Semi Magic Square of Squares for each occurring Magic Sum.

16.1.2 Semi Magic, Edouard Lucas, Seven Magic Lines

Semi Magic Squares with seven Magic Lines of the Lucas Family will occur for higher values of p, q, r and s.

Attachment 16.1.3 shows the occurring Magic Sums and corresponding distinct variable values {ai2} while varying the parameters p, q, r and s over the range {1 ... 33} for seven Magic Lines.

Based on these data, 216 (= 9 * 24) Semi Magic Squares with seven Magic Lines of the Lucas Family could be found.

Attachment 16.1.4 shows one unique Semi Magic Square of Squares for each occurring Magic Sum.

16.1.3 Semi Magic, Linear Equations, Six Magic Lines

Semi Magic Squares of Squares can also be generated with comparable routines as used for Prime Numbers but now based on distinct squared variable values {ai2} with i = 1 ... n.

As the Magic Sum will depend from the selected variable values, the Magic Sum has to be made variable as well.

The equations defining 3th order Semi Magic Squares with six Magic Lines, are:

```a(7) = s1 - a(8) - a(9)
a(4) = s1 - a(5) - a(6)
a(3) =    - a(6) + a(7) + a(8)
a(2) = s1 - a(5) - a(8)
a(1) =      a(5) + a(6) - a(7)
```

with a(9), a(8), a(6) and a(5) the independent variables and a(j) = ai2 for j = 1 ... 9, i = 1 ... n.

Based on the equations above a routine has been written to generate 3th order Semi Magic Squares of Squares with at least six Magic Lines (ref. SqrsSqrs3a).

A collection of 8376 Semi Magic Squares could be found for the range ai = 0 ... 160, which includes:

• The Lucas Family for six Magic Lines for the range (ref. Attachment 16.1.2);
• The Lucas Squares with seven Magic Lines for the Magic Sum 21609 (ref. Attachment 16.1.4);
• A variety of other Semi Magic Squares (ref. Attachment 16.1.5 for one (occasionally two or three) unique squares for each occurring Magic Sum).

The majority of the Magic Sums found for Squares not belonging to the Lucas Family are not squared numbers, although occasionally remarkably close (e.g. 10011).

The first Semi Magic Square of squared primes occurs for the Magic Sum 5691 and was previously published by Jean-Claude Rosa (2006).

16.1.4 Semi Magic, Linear Equations, Seven Magic Lines

The equations defining 3th order Semi Magic Squares with seven Magic Lines, are:

```a(7) =      s1            -     a(8) -     a(9)
a(5) = -    s1 +     a(6) +     a(8) + 2 * a(9)
a(4) =  2 * s1 - 2 * a(6) -     a(8) - 2 * a(9)
a(3) =      s1 -     a(6)            -     a(9)
a(2) =  2 * s1 -     a(6) - 2 * a(8) - 2 * a(9)
a(1) = -2 * s1 + 2 * a(6) + 2 * a(8) + 3 * a(9)
```

with a(9), a(8) and a(6) the independent variables and a(j) = ai2 for j = 1 ... 9, i = 1 ... n.

Based on the equations above a routine has been written to generate 3th order Semi Magic Squares of Squares with seven Magic Lines (ref. SqrsSqrs3b).

However, the only Semi Magic Squares with seven Magic Lines found for the range ai = 1 ... 1143 are the Lucas Family (ref. Attachment 16.1.4).

16.1.5 Magic, Eight Magic Lines, Squared Entries >= 7

As mentioned in Section 16.1 above, up to now nobody has been able to construct a 3th order Magic Square of Squares.

However the existence of Magic Squares with eight Magic Lines but only seven Squared Entries has been proven.

The linear equations defining 3th order Magic Squares are:

```a(7) =      s1   - a(8) -     a(9)
a(6) =  4 * s1/3 - a(8) - 2 * a(9)
a(5) =      s1/3
a(4) = -2 * s1/3 + a(8) + 2 * a(9)
a(3) = -    s1/3 + a(8) +     a(9)
a(2) =  2 * s1/3 - a(8)
a(1) =  2 * s1/3 - a(9)
```

with a(9) and a(8) the independent variables and a(j) = ai2 for j = 1 ... 9, i = 1 ... n.

A 3th order Magic Square consists of a center element a(5) and 4 center symmetric pairs, with a magic sum s1 = 3 * a(5).

Based on the occurring pairs of squares for a certain range, corresponding Magic Sums, center elements and variable values {ai} can be determined (ref. Attachment 16.1.6).

A routine has been written (ref. SqrsSqrs3c) to search for 3th order Magic Squares of Squares with eight Magic Lines and seven or more squared entries based on the equations and data described above.

The first Magic Square with eight Magic Lines and seven squared entries occurs for the Magic Sum 541875 and was previously published by Andrew Brenner (2005).

For the range ai = 1 ... 104 only k2 - multiples of this first occurring square could be found (ref. Attachment 16.1.7).

16.1.6 Semi Magic, Center Element a(5) = s1/3

It should be noticed that none of the Semi Magic Squares shown in the attachments listed in Section 16.1.3 above contain an element a(j) = s1/3.

Based on the equations for Semi Magic Squares with six Magic Lines and data as contained in Attachment 16.1.6, Semi Magic Squares with center element a(5) = s1/3 can be generated for the range ai = 1 ... 104 (ref. SqrsSqrs3d).

Attachment 16.1.8 shows for every applicable Magic Sum the first occurring Semi Magic Square with a(5) = s1/3.

The squares are k2 - multiples of the first square which was previously published by Lee Morgenstern (2009).

16.1.7 Summary

The obtained results regarding the miscellaneous types of order 3 Semi Magic Squares of Squares as deducted and discussed in previous sections are summarized in following table:

 Main Characteristics Original Author Subroutine Results Semi Magic, 6 Magic Lines Eduoard Lucas Semi Magic, 6 Magic Lines - Semi Magic, 7 Magic Lines Eduoard Lucas Semi Magic, 8 Magic Lines, 7 Squared Entries Andrew Brenner Semi Magic, 6 Magic Lines, Center = s1/3 Lee Morgenstern

16.2   Squares of Squares (4 x 4)

16.2.1 Magic, Parametric Solution, Leonhard Euler

The first four Magic Squares of the 4th order, as send by Leonhard Euler in 1770 to Joseph Lagrange, were based on following formula’s (according to the source mentioned above):

 (+ap+bq+cr+ds)2 (+ar–bs–cp+dq)2 (–as–br+cq+dp)2 (+aq–bp+cs–dr)2 (–aq+bp+cs–dr)2 (+as+br+cq+dp)2 (+ar–bs+cp–dq)2 (+ap+bq–cr–ds)2 (+ar+bs–cp–dq)2 (–ap+bq–cr+ds)2 (+aq+bp+cs+dr)2 (+as–br–cq+dp)2 (–as+br–cq+dp)2 (–aq–bp+cs+dr)2 (–ap+bq+cr–ds)2 (+ar+bs+cp+dq)2

The 4 rows and 4 columns sum to the Magic Sum s1, and two supplemental conditions:

• pr + qs = 0;

• a / c = [– d(pq + rs) – b(ps + qr)] / [b(pq + rs) + d(ps + qr)].

ensure that also the two magic diagonals sum to s1 = (a2 + b2 + c2 + d2)(p2 + q2 + r2 + s2).

Attachment 16.2.1 shows the occurring Magic Sums and corresponding distinct variable values {ai2} while varying the parameters a, b, c, d, p, q, r over the range {1 ... 9} for s = -4.

Based on these data 320 (= 10 * 32) Magic Squares could be found.

Attachment 16.2.2 shows one (occasionally two) unique Magic Square of Squares for each occurring Magic Sum.

For (a, b, c, d, p, q, r, s) = (2, k, 5, 0, 1, 2, 8, –4) the formula's can be simplified to:

 (2k + 42)2 (4k + 11)2 (8k – 18)2 (k + 16)2 (k – 24)2 (8k + 2)2 (4k + 21)2 (2k – 38)2 (4k –11)2 (2k – 42)2 (k – 16)2 (8k + 18)2 (8k – 2)2 (k + 24)2 (2k + 38)2 (4k – 21)2

and will result in Magic Squares with s1 = 85 * (k2 + 29) and distinct integers for k = 3, 5, 8, ... (ref. Attachment 16.2.2)

For (a, b, c, d, p, q, r, s) = ((5, k, 9, 0, 2, 3, 6, –4) the formula's can be simplified to:

 (3k + 64)2 (4k + 12)2 (6k – 47)2 (2k + 21)2 (2k – 51)2 (6k + 7)2 (4k + 48)2 (3k – 44)2 (4k – 12)2 (3k – 64)2 (2k – 21)2 (6k + 47)2 (6k – 7)2 (2k + 51)2 (3k + 44)2 (4k – 48)2

and will result in Magic Squares with s1 = 65 * (k2 + 106) and distinct integers for k = 2, 3, 5, ... (ref. Attachment 16.2.2)

16.2.2 Magic, Parametric Solution, Seiji Tomita

More recently comparable Parametric Solutions have been published by Seiji Tomita (November 2018) and are shown in Attachment 16.2.4.

Attachment 16.2.5 shows the first four occurring Magic Squares of Squares and related Magic Sums for each of the defined Parametric Solutions (SqrsSqrs4b).

16.2.3 Magic, Linear Equations

Magic Squares of Squares of order 4 can also be generated with comparable routines as used above for Semi Magic Squares of Squares of order 3.

The linear equations defining 4th order Magic Squares of Squares are:

```a(13) =  s1 - a(14) - a(15) -   a(16)
a( 9) =  s1 - a(10) - a(11) -   a(12)
a( 7) =       a( 8) - a(10) +   a(12) -   a(13) +   a(16)
a( 6) =  s1 - a( 8) - a(11) -   a(12) +   a(13) -   a(16)
a( 5) =     - a( 8) + a(10) +   a(11)
a( 4) =  s1 - a( 7) - a(10) -   a(13)
a( 3) = -s1 - a( 8) + a( 9) + 2*a(10) + 2*a(13) +   a(14)
a( 2) =       a( 8) - a( 9) - 2*a(10) +   a(15) + 2*a(16)
a( 1) =       a( 8) + a(12) -   a(13)
```

with a(16), a(15), a(14), a(12), a(11), a(10) and a(8) the independent variables and a(j) = ai2 for j = 1 ... 16, i = 1 ... n.

An optimized guessing routine (SqrsSqrs4a), produced for the range ai = 0 ... 87, 512 (= 16 * 32) Magic Squares of Squares. The unique square(s) for each occurring Magic Sum are shown in Attachment 16.2.3.

It should be noted that the Magic Squares of Squares with the Magic Sums s1 = 2823, 4875, 6462, 7150 (2), 7735 and 9775 are not a part of the Euler Family (ref. Attachment 16.2.2).

16.2.4 Summary

The obtained results regarding the miscellaneous types of order 4 Magic Squares of Squares as deducted and discussed in previous sections are summarized in following table:

 Main Characteristics Original Author Subroutine Results Magic Squares of Squares Leonhard Euler - Magic Squares of Squares Seiji Tomita Magic Squares of Squares -

16.3   Squares of Squares (5 x 5)

The first Magic Square of Squares of the 5th, 6th and 7th order have been published by Christian Boyer in 2004/2005.

16.3.1 Magic, Generator Method

Magic Squares of Squares of order 5 can be constructed by means of the Generator Method as applied for the construction of Bimagic Squares.

The Generator Method, as applied in this Section for order 5 Magic Squares of Squares with {ai} = 1 ... 48, can be summarized as follows:

• Generate Magic Series for applicable Magic Sums s2 within the range {ai} (ref. MgcLns5);
• Construct Generators with 5 Magic Rows, based on the Magic Series obtained above (ref. CnstrGen5);
• Construct Semi Magic Squares based on the Generators obtained above, by permutating the numbers within the rows (ref. CnstrSqrs5);
• Permutate the rows and columns within the Semi Magic Squares, in order to obtain Magic Squares (if possible).

An example of a Magic Square obtained by permutation of the rows and columns within a Semi Magic Square, is shown below:

Semi Magic Square
 92 102 82 132 312 122 112 252 222 12 142 72 172 212 202 152 232 192 162 22 272 242 62 52 32
Magic Square of Squares
 252 122 112 222 12 192 152 232 162 22 82 92 102 132 312 62 272 242 52 32 172 142 72 212 202

Each 5th order Magic Square of Squares corresponds with 32 (= 8 * 4) transformations as described in Section 3.6.

Attachment 16.3.1 shows 10 Semi Magic Squares as generated with routine CnstrSqrs5.

Attachment 16.3.2 shows 10 resulting Magic Square of Squares.

The first occurring Magic Square of Squares (s2 = 1375) is an aspect of the Boyer Square.

16.3.2 Magic, Linear Equations

Magic Squares of Squares of order 5 can also be generated with a comparable routine as used above for Magic Squares of Squares of order 4.

A fast routine - in which after the main diagonals the remaining rows and columns are calculated - can be used to generate subject Squares.

This sequence together with the properties of a Simple Magic Square result, after deduction, in following set of linear equations:

```a( 1) = s2 - a( 7) - a(13) - a(19) - a(25)
a( 5) = s2 - a( 9) - a(13) - a(17) - a(21)
a( 6) = s2 - a( 7) - a( 8) - a( 9) - a(10)
a(16) = s2 - a(21) - a(11) - a( 6) - a( 1)
a(20) = s2 - a(25) - a(15) - a(10) - a( 5)
a(18) = s2 - a(16) - a(17) - a(19) - a(20)
a(12) = s2 - a(11) - a(13) - a(14) - a(15)
a(23) = s2 - a( 3) - a( 8) - a(13) - a(18)
a(22) = s2 - a( 2) - a( 7) - a(12) - a(17)
a( 4) = s2 - a( 1) - a( 2) - a( 3) - a( 5)
a(24) = s2 - a(21) - a(22) - a(23) - a(25)
```

with a(1), a(4), a(5), a(6), a(12), a(16), a(18), a(20), a(22), a(23) and a(24) the independent variables and a(j) = ai2 for j = 1 ... 25, i = 1 ... n.

An optimized guessing routine (SqrsSqrs5a), produced for the range ai = 1 ... 48, 32 Magic Squares of Squares per defined Magic Sum. An aspect of the unique square(s) for each occurring Magic Sum is shown in Attachment 16.3.2.

16.4   Squares of Squares (6 x 6)

Magic Square of Squares of order 6 can be constructed with the Generator Method, as discussed in Section 16.3.1 above.

An example of a Magic Square obtained by permutation of the rows and columns within a Semi Magic Square, is shown below:

Semi Magic Square
 02 272 42 312 192 222 12 82 332 72 182 322 22 172 62 252 342 212 52 282 292 242 102 152 352 262 132 122 92 162 362 32 202 142 232 112
Magic Square of Squares
 42 272 312 222 02 192 62 172 252 212 22 342 292 282 242 152 52 102 202 32 142 112 362 232 132 262 122 162 352 92 332 82 72 322 12 182

Each 6th order Magic Square of Squares corresponds with 192 (= 8 * 24) transformations as described in Section 6.3.

Attachment 16.4.1 shows 9 Semi Magic Squares as generated with routine CnstrSqrs6.

Attachment 16.4.2 shows 9 resulting Magic Square of Squares.

The first occurring Magic Square of Squares (s2 = 2551) is an aspect of the Boyer Square.

The first Bimagic Squares of order 6 were constructed by Jaroslaw Wroblewski and Lee Morgenstern in 2006 and have been discussed in Section 6.13.4 and 6.13.5.

16.5   Squares of Squares (7 x 7)

Magic Square of Squares of order 7 can be constructed with the Generator Method, as discussed in Section 16.3.1 above.

Magic Square of Squares of order 7 with Bimagic Columns can be based on the 1844 Bimagic Series (ref. Attachment 16.5.3) as published by Achille Rilly (1909).

Generators shall be based on:

• one of the 60 series with 7 odd numbers
• six of the remaining series with 3 odd (and 4 even) numbers

which ensures that subject generators contain the consecutive integers 1 ... 49 and speeds up the construction process.

An example of a Magic Square obtained by permutation of the rows and columns within a Semi Magic Square, is shown below:

Semi Magic Square
 412 342 42 462 142 232 92 372 52 352 152 192 132 492 332 382 272 452 102 82 182 312 22 32 162 472 442 202 252 282 362 212 422 172 242 72 392 402 62 112 482 122 12 292 302 262 322 222 432
Magic Square of Squares
 462 232 342 42 412 142 92 152 132 52 352 372 192 492 452 82 382 272 332 102 182 262 222 292 302 12 322 432 212 172 282 362 252 422 242 62 482 392 402 72 112 122 162 442 22 32 312 472 202

The comparable Boyer Square (bimagic rows) is based on the consecutive integers 0 ... 48 with related Magic Sums s1 = 168 and s2 = 5432 .

Attachment 16.5.1 shows the first 6 Semi Magic Squares as generated with routine CnstrSqrs7.

Attachment 16.5.2 shows 6 resulting Magic Square of Squares with Bimagic Columns.

Although a mathematical proof has not yet been provided (2020), it has been demonstrated by Christian Boyer and others that Bimagic Squares of order 7 can't exist for consecutive integers.

The first Bimagic Squares of order 7 with (non consecutive) distinct integers were published by Lee Morgenstern (2006).

16.6   Summary

The obtained results regarding the miscellaneous types of order 5, 6 and 7 Magic Squares of Squares as deducted and discussed in previous sections are summarized in following table:

 Main Characteristics Property Subroutine Results Magic Squares of Squares Order 5 - Magic Squares of Squares Order 6 - Magic Squares of Squares Order 7 Bimagic Columns
 Next section will provide miscellaneous construction methods for Two and Four Way, V type Zig Zag Magic Squares.