# How to prove that there are infinite number of magic squares consisted of only consecutive prime numbers?

It is easy to find set of $N^2$ consecutive prime numbers (for small values of N) to build magic square (a square grid, where the numbers in each row, and in each column, and the numbers in the main and secondary diagonals, all add up to the same number), see examples lower.

But I can't find a way to prove that for any value M it is possible to find numbers M < $M_1$ < $M_2$ < $M_3$ < ... < $M_{N^2}$, where

1) All $M_i$ are consecutive prime numbers and

2) It is possible to build magic square using only these values (each one exactly once).

Could you suggest me any good direction of research to find the proof?

Examples:

Examples of magic squares 3x3 consisted of consecutive prime numbers:

1480028201 1480028129 1480028183
1480028153 1480028171 1480028189
1480028159 1480028213 1480028141

1850590129 1850590057 1850590111
1850590081 1850590099 1850590117
1850590087 1850590141 1850590069


Examples of magic squares 5x5 consisted of consecutive prime numbers:

59  107 71  23  53
13  37  113 61  89
43  41  83  79  67
101 19  17  103 73
97  101 29  47  31

281 409 311 419 283
359 379 349 347 269
313 307 389 293 401
397 331 337 271 367
353 277 317 373 383


For there to be infinite magic squares of 9 consecutive primes, there would have to be infinite sequences of 3 consecutive primes. The question of if there exists infinite CPAP-k for all k is still an open question in math.

Let's pull some sequences out of the magic square to be sure.

Let the square $$a,b,c$$ $$d,e,f$$ $$g,h,i$$ be magic.

First show that the total is 3 times e: $$(a+e+i)+(d+e+f)+(g+e+c)=r+r+r$$ Rearrange: $$(a+d+g)+(c+f+i)+3e=3r$$ $$2r+3e=3r$$ $$3e=r$$ So for any sum that includes the center element: $$a+e+i=3e$$ $$a-e=e-i$$

Thus we get 4 arithmetic sequences: $$a-e=e-i$$ $$b-e=e-h$$ $$c-e=e-g$$ $$d-e=e-f$$ From these we get: $$2e=a+i=b+h=c+g=d+f$$ Next take: $$r=a+b+c=a+d+g\implies b+c=d+g$$ Then substitute in $g=b+h-c$ to get: $$b+c=d+(b+h-c)$$ Rearrange: $$d-c=c-h$$ The same "trick" can be done too for $(b,g,f),(b,i,d),(h,a,f)$ either using the same method or the symmetries of the magic square. And we have: $$d-i=i-b$$ $$b-g=g-f$$ $$f-a=a-h$$ $$h-c=c-d$$

Now consider the ordering $$b<i<d<g<e<c<f<a<h$$ Most importantly note that the following 3 make arithmetic sequences: $$b<i<d$$ $$g<e<c$$ $$f<a<h$$ and that their middle elements also make an arithmetic sequence: $$i<e<a$$

In conclusion, not only do we need infinite progressions of 3 consecutive primes (which is unknown), we need 3 of them whose balanced primes (that is, the middle prime) are also in a progression.

On a side note, the Green Tao theorem guarantees that there are infinitely many progressions of k non-consecutive primes for arbitrarily large k. Any progression of 9 or more primes can be used to choose sufficient $a,b,c,d,e,f,g,h,i$ so we can say that there are infinitely many magic squares of non-consecutive primes.

• Thank you for these ideas and clear explanation! – Ilya Oct 31 '16 at 4:54