login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A365706
For n >= 1, a(n) is the least prime p such that the arithmetic mean of (n + 1) consecutive primes starting with p is a perfect square, or a(n) = -1 if no such p exists.
0
3, 2393, 5, 827, 53, 271, 1063, 23993, 197, 29, 193, 2143, 359, 6829, 397, 17, 433, 661, 2837, 25171, 13597, 563, 10301, 1814233, 51427, 6781, 316817, 7477, 71, 238919, 11491, 3109, 42293, 38653, 6263, 13043, 474497, 21433, 13, 21419, 16963, 5119, 705209, 183761
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