OFFSET
1,1
COMMENTS
Necessary conditions for 16 primes from which a magic square of order 4 can be made, are:
1. Their sum S is a multiple of 4
2. Magic constant of possible square K=S/4 is even number.
This is equivalent to the requirement for S to be a multiple of 8.
For a fixed magic constant S, it is easy to obtain the set of n^2 consecutive primes that sum up to n*S, and in particular the smallest one: see the PROGRAM in A260673 which computes the smallest prime for any of the magic sums listed here (for n = 4), and A272386 for the n = 5 analog. The converse is trivial, cf. FORMULA and PROGRAM below. - M. F. Hasler, Oct 28 2018
LINKS
Zhao Hui Du, Table of n, a(n) for n = 1..443
Max Alekseyev, Natalia Makarova and others, Discussion in the Magic square finding thread on scientific forum dxdy.ru (in Russian), February-March 2010.
Carlos Rivera, Puzzle 3
FORMULA
EXAMPLE
The following array of 16 consecutive primes:
37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103
also produces the magic square with the constant of K = 276:
[ 41 37 97 101]
[103 83 47 43]
[ 71 67 79 59]
[ 61 89 53 73]
But then not every array of 16 consecutive primes produces a magic square. The next magic square can be made from the array (1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321):
[1229 1249 1321 1319]
[1301 1303 1231 1283] (K = 5118)
[1297 1277 1307 1237]
[1291 1289 1259 1279]
Two more examples:
[4943 4933 5011 5009] [12553 12583 12689 12653]
[4999 4973 4967 4957] (K = 19896), [12641 12647 12601 12589] (K = 50478)
[5003 4969 4987 4937] [12671 12611 12619 12577]
[4951 5021 4931 4993] [12613 12637 12569 12659]
PROG
(PARI) A173981(n, p=A260673[n], N=4)=sum(i=2, N^2, p=nextprime(p+1), p)/N \\ Illustration of the formula. - M. F. Hasler, Oct 28 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Natalia Makarova, Mar 04 2010
EXTENSIONS
a(24)-a(25) from Arkadiusz Wesolowski, Dec 13 2015
Edited and added a(26)-a(27) (using A260673) by M. F. Hasler, Oct 30 2018
STATUS
approved