# Does there exist an algorithm to find solutions to semi-magic prime squares?

Below is a semi-magic prime square that I have discovered, for which all the entries of the square are prime except $1$, and the sum of all the rows and columns are equal to $37$, also prime.

$$\begin{array}{rrr|c} 1\ & 29 & 7\ & 37 \\ 13 & 5\ & 19 & 37 \\ 23 & 3\ & 11 & 37 \\ \hline 37 & 37 & 37 \end{array}$$

However, $1$ is simply not a prime number, so I am trying to find other prime squares for which all the entries are prime with no sole exceptions. I do not have a computer though, so I need to find these by hand, and that is fairly difficult. So, I am trying to find an algorithm for finding prime numbers that can be used to create semi-magic squares.

All the prime numbers in this example are not prime if you add $5$ to their value, $5$ being the central entry of the square, and all of the primes except $3$ and $5$ are of the form $6k \pm 1$ for some $k \geqslant 0$, but the latter applies to all primes greater than $2, 3, 5$.

Is there a method to find semi-magic prime squares? Please reveal other semi-magic prime squares that you may know of, including sites that have the information I am looking for.

• Sorry, I read too hastily your question. – Jean Marie Nov 19 '17 at 1:21
• @JeanMarie hah that's ok. I may have read some other sites too hastily as well. I will double check :) – Mr Pie Nov 19 '17 at 1:24

I just found one, but I don't know a general method to find them

$$\begin{array}{rrr|c} 23 & 13 & 17\ & 53 \\ 11 & 37 & 5\ & 53 \\ 19 & 3\ & 31 & 53 \\ \hline 53 & 53 & 53 \end{array}$$

and another

$$\begin{array}{rrr|c} 17 & 11 & 31\ & 59 \\ 13 & 41 & 5\ & 59 \\ 29 & 7\ & 23 & 59 \\ \hline 59 & 59 & 59 \end{array}$$

and another

$$\begin{array}{rrr|c} 19 & 17 & 37 & 73 \\ 23 & 43 & 7\ & 73 \\ 31 & 13 & 29 & 73 \\ \hline 73 & 73 & 73 \end{array}$$

and another

$$\begin{array}{rrr|c} 23 & 5\ & 43 & 71 \\ 7\ & 47 & 17 & 71 \\ 41 & 19 & 11 & 71 \\ \hline 71 & 71 & 71 \end{array}$$

and another

$$\begin{array}{rrr|c} 19 & 37 & 41 & 97 \\ 31 & 53 & 13 & 97 \\ 47 & 7 & 43 & 97 \\ \hline 97 & 97 & 97 \end{array}$$

and another

$$\begin{array}{rrr|c} 47 & 7\ & 53 & 107 \\ 37 & 59 & 11 & 107 \\ 23 & 41 & 43 & 107 \\ \hline 107 & 107 & 107 \end{array}$$

Square with 61 at centre found

$$\begin{array}{rrr|c} 43 & 23 & 37 & 103 \\ 29 & 61 & 13 & 103 \\ 31 & 19 & 53 & 103 \\ \hline 103 & 103 & 103 \end{array}$$

and the next one

$$\begin{array}{rrr|c} 29 & 31 & 41 & 101 \\ 11 & 67 & 23 & 101 \\ 61 & 3\ & 37 & 101 \\ \hline 101 & 101 & 101 \end{array}$$

I'm choosing the largest prime in the square to go in the centre, but it could go in any of the other squares by rearrangement. The smallest centre prime that can be considered is 29 (for which there is no semi-magic square), as there must be a minimum of 8 odd primes below it. Then the number to which they all add up must be at least 16 greater to give a summation from primes in two different ways i.e. $16=11+5=13+3$

The number of ways a prime can be summed from three other primes appears to increase with the size of the prime. The conjecture would be then that there exists a semi-magic square for every centre prime larger than 31.

• struggling to find squares with 31 and 43 as the largest prime in the centre. Like 29 a square for 31 may not be possible. – James Arathoon Nov 19 '17 at 18:34
• Found one for 43 as the largest prime in the centre. – James Arathoon Nov 19 '17 at 18:44
• Yes that looks pretty interesting... well $31$ is a Mersenne Prime, that is, it is a prime number that is one less than a power of $2$, or simply of the form $2^5 - 1$ – Mr Pie Nov 20 '17 at 10:49
• Hoo hoo hoo! A CONJECTURE! What do you want to call it? Arathoon's Conjecture? Hah if it does become a reality, I will credit you for it :) However, having mentioned that $31$ is a Mersenne Prime, I will see if I can find a semi-magic square equal to $127$ the following Mersenne Prime, $2^7 - 1$ – Mr Pie Nov 20 '17 at 10:54
• You could call it the "3-Prime Square Conjecture" – James Arathoon Nov 20 '17 at 11:54