OFFSET
2,1
FORMULA
a(n) = A230327(n^2).
EXAMPLE
Define sp(k,n) to be the sum of n^2 consecutive primes starting at prime(k).
a(2) = 3 because sp(k,2) at k=3 is 5 + 7 + 11 + 13 = 36 = 6^2, a square, and no smaller k has this property.
a(3) = 1 because sp(k,3) at k=1 is 2 + 3 + 5 + 7 + 11 + 13 + 17 + 19 + 23 = 100 = 10^2, a square, and no smaller k has this property.
a(4) = 78 because sp(k,4) at k=78 is 397 + 401 + ... + 487 = 7056 = 84^2, a square, and no smaller k has this property.
PROG
(PARI)
\\ sum of n^2 consecutive primes starting at prime(k).
sp(k, n)=my(u=primes([prime(k), prime(k+n*n-1)])); return(vecsum(u))
\\ Least number k such that sp(k, n) is a square.
a(n)=my(k=1); while(!issquare(sp(k, n)), k++); k
(PARI) a(n) = { my(pr = primes(n^2), s = vecsum(pr), startprime = nextprime(pr[#pr] + 1), res = 1); pr = List(pr); forprime(p = startprime, oo, if(issquare(s), return(res); ); res++; s += (p - pr[1]); listput(pr, p); listpop(pr, 1); ) } \\ David A. Corneth, Nov 13 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Jean-Marc Rebert, Nov 12 2022
STATUS
approved