Construction methods

Here is the secret used to obtain tetra and pentamagic squares, the Viricel-Boyer method for computing your own multimagic squares:

• Start with the top left corner, choosing two numbers N1 and N2, both different and not zero
• Compute row 0 and column 0 with the help of the numeral multiplication « @ »
• Then compute the other rows and columns with the help of the numeral addition « & » of the row 0 and column 0 elements

 Col 0 Col 1 Col 2 Col i Li 0 0 = (0,0) N1 = (a,b) 2@(a,b) i@(a,b) Li 1 N2 = (c,d) (a,b) & (c,d) 2@(a,b) & (c,d) i@(a,b) & (c,d) Li j j@(c,d) (a,b) & j@(c,d) 2@(a,b) & j@(c,d) i@(a,b) & j@(c,d)

The (a,b) notations indicates a number decomposed in base n (n being the square order).

Now take the example of our tetramagic square. See its top left corner:

 0 139938 140551 1957

N1 = 139938 = 273*512(square order) + 162      So (a,b) = (273,162)
N2 = 140551 = 274*512(square order) + 263      So (c,d) = (274,263)

We do not know the true rules which permit us to know if a pair N1 and N2 will generate a multimagic square. But you will find pairs, other than 139938/140551, which also give 512th-order tetramagic squares: the smallest are 535/1103, 535/1145, and so on...

What we call here the numeral addition « & » is well known by software developers : it is the EXCLUSIVE OR

 & 0 1 0 0 1 1 1 0

139938 =          100010001010100010 (in base 2)
140551 =          100010010100000111 (in base 2)
139938 & 140551 = 000000011110100101 (in base 2) = 1957 (in base 10).

And 1957 is really the number that we find in the tetramagic square seen above, under the 139938 number.

Numeral multiplication @.

We will now compute the penultimate cell of the row 0 of our tetramagic square.

It is equal to 510@(273,162). We will start by computing 510@273:

510 =   111111110 (in base 2)
273 =   100010001 (in base 2)

The numeral multiplication is computed like the classical multiplication that we learn at school, except that the final addition is not done normally, but instead by numeral addition (so binary « exclusive or » ). It gives:

111111110
@ 100010001
111111110
& 111111110
& 111111110
=
011110000000011110

In order to conclude the multiplication and so that the number remains the same size as its two operands (lower than 512, so 9 bits coded), we carry out a supplemental numeral additon of the left and right parts of the result, like this:

011110000
& 000011110
= 011101110

So, the result of 510@273 is 11101110 in base 2, equal to 238 in our good old base 10. When, by the same method, we compute 510@162, we find 349.

So, the result of 510@(273,162) is (238,349) = 238*512 + 349 = 122205.

Have a look at the top right corner of our tetramagic square. We recognize this number in the penultimate cell of the row 0:

 122205 262143 260186 121592