cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

Original entry on oeis.org

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

Views

Author

Ctibor O. Zizka, Oct 15 2023

Keywords

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)
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. - Ctibor O. Zizka, Oct 18 2023

Examples

			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.
		

Crossrefs

Programs

  • 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

Extensions

More terms from Amiram Eldar, Oct 18 2023