A372041 Least prime p such that the sum of squares of the 2n + 1 consecutive primes starting with p is prime, or -1 if no such p exists.
3, 3, 5, 3, 3, 5, -1, 5, 5, -1, 3, 7, -1, 3, 13, -1, 5, 5, -1, 7, 23, -1, 13, 5, -1, 7, 5, -1, 59, 29, 3, 3, 5, -1, 3, 5, -1, 13, 11, -1, 37, 23, -1, 43, 11, -1, 3, 5, -1, 11, 5, -1, 5, 19, -1, 5, 43, -1, 13, 29, -1, 7, 19, -1, 41, 47, -1, 13, 11, 3, 7, 5, -1, 29, 7, -1, 79, 13, 3, 3
Offset: 1
Keywords
Examples
a(6) = 5 because 5 is the smallest of 2*6+1 = 13 consecutive primes whose sum of squares = 5^2 + 7^2 + 11^2 + 13^2 + 17^2 + 19^2 + 23^2 + 29^2 + 31^2 + 37^2 + 41^2 + 43^2 + 47^2 = 10453 is prime. a(7) = -1 because 7 == 1 (mod 3) so its only possibility is that the sum starts at 3, but 3^2 + ... + 53^2 = 13271 is not prime.
Programs
-
PARI
a(n) = if ((n % 3) == 1, my(vp = primes(2*n+2)); if (isprime(sum(k=2, #vp, vp[k]^2)), return (3), return(-1));); my(vp = primes(2*n+2)); while(! isprime(sum(k=2, #vp, vp[k]^2)), vp = concat(setminus(vp, Set(vp[1])), nextprime(vp[2*n+2]+1))); vp[2]; \\ Michel Marcus, May 16 2024
Comments