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.

A357133 a(n) is the least prime that is the arithmetic mean of n consecutive primes.

This page as a plain text file.
%I A357133 #16 Oct 02 2022 20:01:41
%S A357133 5,127,79,101,17,269,491,727,53,23,71,181,29,31,37,43,563,331,883,283,
%T A357133 173,307,157,113,353,571,347,89,263,139,179,1201,281,1553,137,5167,
%U A357133 347,563,2083,2087,491,1867,353,463,1973,199,599,4373,149,9929,277,463,1259,251,397,2897,787,263,2161
%N A357133 a(n) is the least prime that is the arithmetic mean of n consecutive primes.
%H A357133 Robert Israel, <a href="/A357133/b357133.txt">Table of n, a(n) for n = 3..7000</a>
%e A357133 a(5) = 79 because 79 is the average of the 5 consecutive primes 71, 73, 79, 83, 89, and 79 is the least prime that works.
%p A357133 P:= [seq(ithprime(i),i=1..10^5)]:
%p A357133 S:= ListTools:-PartialSums(P):
%p A357133 g:= proc(n) local k,r;
%p A357133    for k from 1 to 10^5-n do
%p A357133       r:= (S[k+n]-S[k])/n;
%p A357133       if r::integer and isprime(r) then return r fi
%p A357133    od;
%p A357133    -1
%p A357133 end proc:
%p A357133 map(g, [$3..100]);
%t A357133 a={}; n=3; For[k=1, k<=1200, k++, If[PrimeQ[p=Sum[Prime[k+i], {i,0,n-1}]/n], AppendTo[a,p]; n++; k=1]]; a (* _Stefano Spezia_, Sep 15 2022 *)
%o A357133 (Python)
%o A357133 from itertools import islice
%o A357133 from sympy import isprime, nextprime
%o A357133 def agen():
%o A357133     n, plst0 = 3, [2, 3, 5]
%o A357133     while True:
%o A357133         plst = plst0[:]
%o A357133         while True:
%o A357133             q, r = divmod(sum(plst), n)
%o A357133             if r == 0 and isprime(q): yield q; break
%o A357133             plst = plst[1:] + [nextprime(plst[-1])]
%o A357133         plst0.append(nextprime(plst0[-1]))
%o A357133         n += 1
%o A357133 print(list(islice(agen(), 60))) # _Michael S. Branicky_, Sep 14 2022
%Y A357133 Cf. A006562, A126096, A219478, A122531
%K A357133 nonn
%O A357133 3,1
%A A357133 _J. M. Bergot_ and _Robert Israel_, Sep 14 2022