Manual Construction
Previus Credits Index Next

I had started to build my prime square using the previous analysis as a start point. The only thing to clarify is that I choose the order 15, because we just have a 12 order prime magic square.

So, I build this snake square:

    1    2    3    4    5    6    7    8    9   10   11   12   13   14   15
   30   29   28   27   26   25   24   23   22   21   20   19   18   17   16
   31   32   33   34   35   36   37   38   39   40   41   42   43   44   45
   60   59   58   57   56   55   54   53   52   51   50   49   48   47   46
   61   62   63   64   65   66   67   68   69   70   71   72   73   74   75
   90   89   88   87   86   85   84   83   82   81   80   79   78   77   76
   91   92   93   94   95   96   97   98   99  100  101  102  103  104  105
  120  119  118  117  116  115  114  113  112  111  110  109  108  107  106
  121  122  123  124  125  126  127  128  129  130  131  132  133  134  135
  150  149  148  147  146  145  144  143  142  141  140  139  138  137  136
  151  152  153  154  155  156  157  158  159  160  161  162  163  164  165
  180  179  178  177  176  175  174  173  172  171  170  169  168  167  166
  181  182  183  184  185  186  187  188  189  190  191  192  193  194  195
  210  209  208  207  206  205  204  203  202  201  200  199  198  197  196
  211  212  213  214  215  216  217  218  219  220  221  222  223  224  225
At this point I should execute some changes in line, but I still had not hypothesized what Muncey could have fact at this point, therefore I passed directly to the correspondent prime square:
      1    3    5    7   11   13   17   19   23   29   31   37   41   43   47    9308
    113  109  107  103  101   97   89   83   79   73   71   67   61   59   53    8370
    127  131  137  139  149  151  157  163  167  173  179  181  191  193  197    7200
    281  277  271  269  263  257  251  241  239  233  229  227  223  211  199    5964
    283  293  307  311  313  317  331  337  347  349  353  359  367  373  379    4616
    463  461  457  449  443  439  433  431  421  419  409  401  397  389  383    3240
    467  479  487  491  499  503  509  521  523  541  547  557  563  569  571    1808
    659  653  647  643  641  631  619  617  613  607  601  599  593  587  577     348
    661  673  677  683  691  701  709  719  727  733  739  743  751  757  761   -1090
    863  859  857  853  839  829  827  823  821  811  809  797  787  773  769   -2682
    877  881  883  887  907  911  919  929  937  941  947  953  967  971  977   -4252
   1069 1063 1061 1051 1049 1039 1033 1031 1021 1019 1013 1009  997  991  983   -5764 
   1087 1091 1093 1097 1103 1109 1117 1123 1129 1151 1153 1163 1171 1181 1187   -7320
   1291 1289 1283 1279 1277 1259 1249 1237 1231 1229 1223 1217 1213 1201 1193   -9306
   1297 1301 1303 1307 1319 1321 1327 1361 1367 1373 1381 1399 1409 1423 1427  -10680

24  96   72   60   66   30   58   48   0   -10  -46  -50  -74  -96  -86  -68   -52
Note that I don't report the sum of columns, rows, and diagonals, but the difference with magic constant. How you can see, only one columns is at the magic value, while the others are near to the expected value.

At this point, if you want to make one column to the right magic constant, you have to change some values of that column with other values of other columns (possibly in the same rows for not changing the rows state - this is only necessary if the rows was at the right magic value-).

I built an interactive program for doing this changes (the program is grown as I need subsequently, so it is not good coded!). In less time I make all the columns to the right magic state, because founds the right shifts was easy (only the latest columns make me more times).


Ok, I must apply the some method to the rows, but now the difference
with the expected value may reaches 10000. But if you changes many numbers,
you can reduce those values to less difference, so it is easy to find the right
changes. 
The work goes right until the last 4 rows, then I did not be able to find the changes for making them to the magic value. So, I built a procedure that searches the right changes from two non magic rows, and this was the right street.

Now all rows and columns are to the magic state, but the diagonal are not right.
So I built a procedure that swap two rows (or two columns)  with some scheme or in
random manner until the two diagonals become to the magic state (if we change the
position of two rows, the magic state of rows and columns don't change, while the
diagonal state will changes). 
Sorry, this method did not find the expected solution.

Ok, but if we changes rows while we look for one diagonal become to the magic state using the procedure that automatically search the right value as in the previous step? Yes, but the other diagonals?
I build this procedure and make it to search more solution until the other diagonal become to the magic state. This find out the solution:

                           Prime Magic Square of order 15

  1087  953 1093  167  499   97  829 1237   79   73  809  967  787  911   47
   463  461  457  491  691  503   89  163   23 1019 1223 1399  937  523 1193
     1 1301  307 1163 1319 1259   17   19  877   29  547  181 1187 1217  211
   661 1063  271  887  263  317  331 1361  239  173  389 1097 1213  199 1171
  1069  673  677  311  313  257  251  337 1367  419 1013  373  397  769 1409
   659  293  647  643  641  439  709  617  613  607  601 1201  593  599  773
  1021    3  883  103  839  631 1117  823  283 1151  149  577   41 1427  587
   127  653 1303    7 1277 1321  157  719  727 1229  947  227   61  743  137
   139  859    5  421  101  701  433  521  449  941 1381  991  751 1181  761
  1297  131 1283 1307  179  151 1373  241  347 1327   71   59 1423   67  379
  1291 1091  487  269 1049 1109 1033  431  881  349  229  409  223  401  383
   113  109 1061 1279 1103 1039  509  929  569  733 1153  757  191   37   53
   281 1289  107 1051   11   13  919 1031 1129  541  353  557  367 1009  977
   563  277  857  853  443  971 1249 1123 1231  233   31   43  997  193  571
   863  479  197  683  907  827  619   83  821  811  739  797  467  359  983
Ok, try now with order 17: build snake square, make rows, make columns, find automatically the solution.
Result: after 5 hour I have a 17 order prime square:
                           Prime Magic Square of order 17

    1   43    5    7 1721 1709  379  827 1823  419 1319 1663  463 1361  911  659 1381
  139  137  131  127  113 1549 1553  103  101 1571 1579 1583 1597   79 1607 1109 1613
  149  151  157  163  167 1789 1801  181  191 1831  197 1321 1867 1097 1103  647 1879
  337  331  317 1531  311  109 1459 1559 1567  839  263 1433  631  919 1423 1609   53
  347  349  353  359  367  373 1699 1697  389 1669 1667  409  683  421 1627 1621  661
  557  547  541  313  521 1453  503  283  829 1307 1847 1861   41  461 1367 1373  887
 1013 1009  997  991  983  977  971  967  953  947   31  937 1327 1601   47  881   59
 1753 1759 1777 1783 1787  173  227 1811   23   97   89  467  929  677  457  439  443
  769  761  757  751  743  739  719  727  733  709  701  691 1657 1637   71  907 1619
 1259 1277 1279 1283 1289 1291 1297 1301 1303  193 1181  199  211  223  643  229  233
 1747 1733 1741 1723   11   13   17  383 1693   29  941  857  397    3 1151 1129 1123
 1493 1489 1487 1483 1481  307  293 1471  281  277  853  619  859 1153  251  241  653
  797  787  773  809  811  821  823   19 1451 1447 1439   37 1429 1427  877   61  883
 1019 1021 1051 1039 1033 1049 1031 1061 1063 1069 1087 1091   73  641  179   67 1117
 1249 1217 1231 1229 1223 1237 1213 1201 1193 1187  401  269  271  257  431  433  449
  563  569  571  577  587  593  599  601  607  613  617 1171 1163 1871 1873 1877  239
 1499 1511 1523  523 1543  509  107  499  491  487  479   83 1093  863  673 1409 1399
Conclusion

At this point I can say that snake construction was useful only for make the columns near to the magic state, but for rows the difference are big (however snake construction are important for order 12 because even the rows are more near to the magic state, but we see this more after).
But can we build a program that automatically construct a prime magic square? If we build it we can easier try to find square of other order.

 
Top
Magic
Magic Square Research Tognon Stefano Research