login
A354966
a(n) is the least prime p such that the sum of squares of n consecutive primes starting with p is GCD(n,24) times a prime.
1
3, 7, 7, 3, 83, 5, 23, 13, 5, 3, 73, 5, 3, 5, 13, 5, 5, 5, 5, 53, 29, 3, 7, 7, 7, 13, 11, 3, 5, 13, 7, 5, 7, 5, 7, 5, 7, 89, 7, 7, 47, 23, 5, 17, 17, 13, 89, 5, 7, 19, 13, 7, 31, 5, 19, 13, 13, 59, 5, 29, 19, 29, 23, 3, 13, 5, 11, 13, 7, 3, 7, 5, 43, 29, 23, 13, 97, 11, 17, 71, 11, 37, 71, 23, 7
OFFSET
2,1
COMMENTS
Since p^2 == 1 (mod 24) for all primes p > 3, the sum of n squares of such primes is congruent to n (mod 24) and thus divisible by GCD(n,24).
LINKS
EXAMPLE
a(4) = 7 because the sum of squares of 4 consecutive primes starting with 7 is 7^2+11^2+13^2+17^2 = 628 = 4*157 where GCD(4,24) = 4, and 157 is prime, and 7 is the least prime that works: 2^2+3^2+5^2+7^2 = 3*29, 3^2+5^2+7^2+11^2 = 4*3*17, and 5^2+7^2+11^2+13^2 = 4*7*13.
MAPLE
P:= select(isprime, [2, seq(i, i=3..10^6, 2)]):
PS:= map(t -> t^2, P):
SPS:= ListTools:-PartialSums(PS): N:= nops(SPS):
f:= proc(n) local k, j, t, d;
d:= igcd(n, 24);
for k from 1 to N-n do
t:= (SPS[k+n]-SPS[k])/d;
if t::integer and isprime(t) then return P[k+1] fi
od;
-1 # a value of -1 indicates that the list of primes needs to be extended
end proc:
map(f, [$2..100]);
PROG
(Python)
from math import gcd
from sympy import sieve, isprime
def A354966(n):
a, s = gcd(n, 24), sum(sieve[j]**2 for j in range(1, n+1))
for i in count(1):
(b, c), p = divmod(s, a), sieve[i]
if c == 0 and isprime(b):
return p
s += sieve[i+n]**2-p**2 # Chai Wah Wu, Jun 14 2022
CROSSREFS
Sequence in context: A199277 A346588 A219313 * A021730 A153844 A197476
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Jun 13 2022
STATUS
approved