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”).
%I #39 Oct 22 2023 17:03:07
%S 3,2393,5,827,53,271,1063,23993,197,29,193,2143,359,6829,397,17,433,
%T 661,2837,25171,13597,563,10301,1814233,51427,6781,316817,7477,71,
%U 238919,11491,3109,42293,38653,6263,13043,474497,21433,13,21419,16963,5119,705209,183761
%N 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.
%C Does a(n) exists for all n >= 1 ?
%C From _David A. Corneth_, Oct 18 2023: (start)
%C 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.
%C This means s(n) = (n + 1) * m^2. If n is even then m is odd if a(n) > 2.
%C 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)
%C From _Ctibor O. Zizka_, Oct 18 2023: (start)
%C 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)
%e 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.
%o (PARI) isok(x) = (denominator(x)==1) && issquare(x);
%o 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
%o (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
%Y Cf. A000040, A007504, A053001, A225195.
%K nonn
%O 1,1
%A _Ctibor O. Zizka_, Oct 15 2023
%E More terms from _Amiram Eldar_, Oct 18 2023