OFFSET
1,1
COMMENTS
A necessary condition for the existence of a magic square consisting of n^2 consecutive odd primes.
LINKS
Robert Israel, Table of n, a(n) for n = 1..1000
EXAMPLE
a(5)=13 since 13+17+ ... +113 = 1565 = 5*313 and 313 == 5 (mod 2).
MAPLE
P:= select(isprime, [seq(i, i=3..10^6, 2)]):
nP:= nops(P):
PS:= [0, op(ListTools:-PartialSums(P))]:
f:= proc(n) local i, s;
for i from 1 to nP+1-n^2 do
s:= PS[i+n^2]-PS[i];
if s mod n = 0 and (s/n - n) mod 2= 0 then return P[i] fi
od;
FAIL
end proc;
map(f, [$1..100]); # Robert Israel, Jul 18 2023
PROG
(PARI) for(n=1, 50, k=2; m=n^2; aflag=0; while(k+m<=500000&&aflag==0, s=0; for(x=k, k+m-1, s=s+prime(x)); if(s%n==0&&(s/n)%2==n%2, print1(prime(k), ", "); aflag=1); k++))
CROSSREFS
KEYWORD
nonn
AUTHOR
H. K. Gottlob Maier (1korrago(AT)freenet.de), Sep 20 2001
STATUS
approved