Contatta Aggiungi Segnala Altro Crea
 Double Square

In the magic square research was find some of them with other characteristic that make them more interesting. One are the kind that I call double square.

Definition
Give a normal magic square of order N, it is a double square if the square that we obtain from it when we apply a function to all its element is still magic (with a different magic constant)

In this case I want to find a prime magic square with its corresponding non prime square still magic. So I want a double square with the function to apply is the P() that we see in the prime analysis.

I choose the order 12 because it is the low, and then I generate many prime squares to see if the non prime was near to the magic state. Well, only 4/5 rows or columns where still magic, so I change method: I build it.

Let me call A the prime square and B the corresponding not prime square. Suppose that A is magic and we want to make the i rows of B to become magic: for doing this we must choose the values from row i and from one row j that give the magic constant for B and that the same shifts don't changes the sum of the value for row i of square A (that was magic).
In other hand we must give another controls to the procedure that find the magic state of one row of A (when we build it): it may choose the changes that make even A and B rows magic.

Ok, if this work ok, what we do for the diagonal?
I think that this was a big problem, so I generate prime square until one had the corresponding not prime with the diagonals ok; if we add another control that don't allow changes of value in the diagonals for the procedure that give one row magic, we have solve the problem.

Yes, but even if I find that square, the procedure didn't find the right solution, because the available changes are very little if we don't allow diagonal elements to changes.

So, we must think for diagonals solution when rows and columns are magic.
Sorry, even if I allow diagonal element to changes, the procedure that give rows to magic don't make all rows magic.
But this is not a problem, let the procedure to pike up value in other manner, not only from 1° and 2° rows or 1° and 3° rows, ...
Yes, but I want to find one square, so I take the best square that the automatic procedure give with rows and columns magic and manually indicate the rows to changes. This works ok and I have only to give diagonals magic.

So I take the diagonal procedure and use it for making the A square magic, and then look if even B become with magic diagonals value. The important rule is to not stop the diagonal procedure when it find A magic, but let it search for other solution (until B become magic).

With less than 5 hour in the 286 I find this double square:

```                                Normal:

88     9   104    85    15    70    58    49    42   141   106   103
144    54   132   114    40    46   118    26    37   102    10    47
128    84     4    87   140    67    71   108    32    69    50    30
12    83    51    86    31   119    36    77    55   143   142    35
29    14    96    98   125     5    91    38   136    44    64   130
72   112    62   121    23    25   109    27    63     7   127   122
43    45   134    94    34   105   124   139     3    60    24    65
66    33    97     6    90    19   131    41   126    75    48   138
8    81    95    68   133    89    39    20   129    73    22   113
99   137    11    92    82   135    16   120    78    18    61    21
80   111    28     2    57    74    76   110   117    79   123    13
101   107    56    17   100   116     1   115    52    59    93    53

Prime:

457    23   569   439    47   349   271   227   181   811   577   563
827   251   743   619   173   199   647   101   157   557    29   211
719   433     7   449   809   331   353   593   131   347   229   113
37   431   233   443   127   653   151   389   257   823   821   149
109    43   503   521   691    11   467   163   769   193   311   733
359   613   293   661    83    97   599   103   307    17   709   673
191   197   757   491   139   571   683   797     5   281    89   313
317   137   509    13   463    67   739   179   701   379   223   787
19   419   499   337   751   461   167    71   727   367    79   617
523   773    31   479   421   761    53   659   397    61   283    73
409   607   107     3   269   373   383   601   643   401   677    41
547   587   263    59   541   641     1   631   239   277   487   241
```

 Magic Square Tognon Stefano Research