Saturday, September 1, 2018

mathematics - 3x3 "Magic Square" of Prime Numbers


During the thinking and analysis of some mathematical problems, I came up with this puzzle:


enter image description here


Just like any magic square, one has to fill in $9$ different numbers $P_1, P_2, \dots P_9$ to a $3 \times 3$ grid. But this time, all the numbers must be different prime numbers. In addition, the $8$ sums ($3$ horizontal, $3$ vertical and $2$ diagonal) must not only be different prime numbers among themselves, but also be different from the $9$ numbers in the grid. In other words, $P_1, P_2, \dots, P_9, S_1, S_2, \dots, S_8$ must be all different prime numbers.


I suppose there are infinitely many solutions, so the challenge is to minimize the sum $S_1 + S_2 + \dots + S_8$. Here is one answer I found:


enter image description here


The total of the $8$ sums is $480$. I believe there are very likely solutions that can beat this total. You are welcome to have a try.


Update (plus Spoiler Alert): It was verified (using computer program) that one of the answers here (the accepted answer) is the optimal solution that cannot be beaten. There are $8$ optimal solutions, but actually they are the same because if you rotate one of the solutions by $90$, $180$ and $270$ degrees, and also horizontally flip each of the resulting grid, you will get all $8$ answers. Hence the "open-ended" tag has been removed.




Answer



With a brute force program solver written in C#, I found a solution with sum 366:


    3 11  5 | 19
37 17 13 | 67
7 31 23 | 61
---------+---
29 47 59 41 | 43

I let the program run until the top left corner was 61, so I'm pretty sure that there are no better solutions, but feel free to look for yourself:


Source code at PasteBin (you might want to change the initial value of recordSum to something bigger than 366 to actually get some results).



No comments:

Post a Comment

classical mechanics - Moment of a force about a given axis (Torque) - Scalar or vectorial?

I am studying Statics and saw that: The moment of a force about a given axis (or Torque) is defined by the equation: $M_X = (\vec r \times \...