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”).

A374576
a(n) is the smallest prime prime(k) such that prime(k-n) and prime(k+n) are balanced primes of order n.
1
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,1
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.
LINKS
EXAMPLE
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.
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]);
PROG
(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
CROSSREFS
Sequence in context: A375916 A252317 A250026 * A374507 A194352 A234477
KEYWORD
nonn
AUTHOR
Robert Israel, Jul 11 2024
STATUS
approved