OFFSET
1,1
COMMENTS
Does a(n) exists for all n >= 1 ?
From David A. Corneth, Oct 18 2023: (start)
Let s(n) be the sum of n + 1 consecutive primes starting with a(n). Then s(n)/(n+1) = m^2 for some positive integer m.
This means s(n) = (n + 1) * m^2. If n is even then m is odd if a(n) > 2.
As s(n) >= A007504(n) we have m^2 >= s(n)/(n+1) >= A007504(n)/(n+1) i.e. m >= sqrt(A007504(n)/(n+1)). So for some m we can see if m^2 * (n+1) is the sum of n+1 consecutive primes and if so a(n) is the smallest prime of these n+1 primes after testing all candidates up to m. (End)
From Ctibor O. Zizka, Oct 18 2023: (start)
s(n) = (n + 1)* a(n) + Sum_{i=0..(n-1)} (n-i)*g(i+1), thus we have Sum_{i=0..(n-1)} (n-i)*g(i+1) = (m^2 - a(n)) * (n + 1), g(j) are the n gaps between n + 1 consecutive primes. (End)
EXAMPLE
n = 2: we search for the least prime(i) such that (prime(i) + prime(i + 1) + prime(i + 2))/3 = m^2, m an integer. This is valid for (2393 + 2399 + 2411)/3 = 49^2 thus a(2) = 2393.
PROG
(PARI) isok(x) = (denominator(x)==1) && issquare(x);
a(n) = my(k=1); while (!isok((vecsum(primes(k+n))-vecsum(primes(k-1)))/(n+1)), k++); prime(k); \\ Michel Marcus, Oct 16 2023
(PARI) a(n) = {my(m = n + 1, ps = vector(m, i, prime(i)), s); forprime(p = ps[m] + 1, , s = vecsum(ps); if(!(s % m) && issquare(s/m), return(ps[1])); ps = concat(vecextract(ps, "^1"), p)); } \\ Amiram Eldar, Oct 18 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Ctibor O. Zizka, Oct 15 2023
EXTENSIONS
More terms from Amiram Eldar, Oct 18 2023
STATUS
approved