After constructing magic squares of any size Stifel gives two examples of “multiplicative” magic squares. They are related by the base-2-logarithm to the “additive” magic squares.
This tests for a magic square with operation Plus, Times, ...
In[]:=
MagicSquareQ[m_?SquareMatrixQ,op_:Plus]:=Equal@@Join[op@@@m,op@@@m,{Tr[m,op],Tr[Reverse/@m,op]}]
Testrun with Times:
In[]:=
MagicSquareQ[{{a,b,c},{d,e,f},{g,h,i}},Times]
Out[]=
abcdefghiabcdefghiaeiceg
Let’s check Stifel’s later example first:
In[]:=
Grid[Stifel3x3={{8,256,2},{4,16,64},{128,1,32}},FrameAll,BackgroundLightBlue]
Out[]=
8 | 256 | 2 |
4 | 16 | 64 |
128 | 1 | 32 |
Is this a multiplicative magic square?
In[]:=
MagicSquareQ[Stifel3x3,Times]
Out[]=
True
Now we take the base-2 logarithm:
In[]:=
Grid[Log2[Stifel3x3],FrameAll,BackgroundLightBlue]
Out[]=
3 | 8 | 1 |
2 | 4 | 6 |
7 | 0 | 5 |
You can add 1 for convenience:
In[]:=
Grid[1+Log2[Stifel3x3],FrameAll,BackgroundLightBlue]
Out[]=
4 | 9 | 2 |
3 | 5 | 7 |
8 | 1 | 6 |
Scholion: We all know, that up to rotation and reflection this is the only normal magic square of order 3.
Are these “additive” magic squares?
In[]:=
{MagicSquareQ[Log2[Stifel3x3]],MagicSquareQ[1+Log2[Stifel3x3]]}
Out[]=
{True,True}
Let’s check the first example now:
In[]:=
Grid[Stifel4x4={{32768,4,2,4096},{256,32,64,2048},{16,512,1024,128},{8,16384,8192,1}},FrameAll,BackgroundLightBlue]
Out[]=
32768 | 4 | 2 | 4096 |
256 | 32 | 64 | 2048 |
16 | 512 | 1024 | 128 |
8 | 16384 | 8192 | 1 |
Is this a multiplicative magic square?
In[]:=
MagicSquareQ[Stifel4x4,Times]
Out[]=
True
Now we take the base-2 logarithm:
In[]:=
Grid[Log2[Stifel4x4],FrameAll,BackgroundLightBlue]
Out[]=
15 | 2 | 1 | 12 |
8 | 5 | 6 | 11 |
4 | 9 | 10 | 7 |
3 | 14 | 13 | 0 |
You can add 1 for convenience:
In[]:=
Grid[1+Log2[Stifel4x4],FrameAll,BackgroundLightBlue]
Out[]=
16 | 3 | 2 | 13 |
9 | 6 | 7 | 12 |
5 | 10 | 11 | 8 |
4 | 15 | 14 | 1 |
Are these “additive” magic squares?
In[]:=
{MagicSquareQ[Log2[Stifel4x4]],MagicSquareQ[1+Log2[Stifel4x4]]}
Out[]=
{True,True}
Scholion: We all know, that up to rotation and reflection there are 880 normal magic square of order 4.