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.

Showing 1-1 of 1 results.

A374576 a(n) is the smallest prime prime(k) such that prime(k-n) and prime(k+n) are balanced primes of order n.

Original entry on oeis.org

7829, 18713, 211, 19891, 2381, 63649, 183971, 11287, 67957, 2197697, 345749, 1359913, 2267827, 543383, 16705691, 2667311, 3369869, 38094029, 35605289, 3303059, 26184253, 44116757, 4271017, 35099179, 44191919, 296115661, 86828801, 169863823, 991, 163355419, 10301623, 115044443, 240284293
Offset: 1

Views

Author

Robert Israel, Jul 11 2024

Keywords

Comments

a(n) is the least prime that is the start and end of sequences of 2*n+1 consecutive primes whose arithmetic means are their medians.

Examples

			a(3) = 211 because the 7 consecutive primes 179, 181, 191, 193, 197, 199, 211 ending at 211 have mean = median = 193 and the 7 consecutive primes 211, 223, 227, 229, 233, 239, 241 starting at 211 have mean = median = 229, and 211 is the first prime for which this works.
		

Crossrefs

Programs

  • Maple
    f:= proc(n)
     local S,i;
     S:= [seq](ithprime(i),i=1..4*n+1);
     do
       if convert(S[1..2*n+1],`+`) = (2*n+1)*S[n+1] and convert(S[2*n+1..4*n+1],`+`) = (2*n+1)*S[3*n+1] then
       return S[2*n+1] fi;
       S:= [op(S[2..-1]),nextprime(S[-1])]
     od;
    end proc:
    map(f, [$1..35]);
  • PARI
    alist(N) = {my(r=vector(N), p=primes(4*N+1), t); while(t=Vec(select(x->!x, r, 1)), foreach(t, n, my(w=2*n+1); if(vecsum(p[1..w])==w*p[1+n] && vecsum(p[w..2*w-1])==w*p[w+n], r[n]=p[w])); p=primes([p[2], nextprime(p[#p]+1)])); r;} \\ Ruud H.G. van Tol, Jul 13 2024
Showing 1-1 of 1 results.