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

A247189
a(n) is the least integer k such that prime(k) < (prime(n)+ prime(n+1) + ... + prime(n+k))/k <= prime(k+1).
1
1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 7, 7, 6, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 7, 8, 9, 8, 8, 7, 7, 8, 8, 9, 8, 8, 9, 9, 9, 10, 10, 9, 9, 8, 9, 10, 9, 9, 9, 8, 10, 10, 10, 10, 10, 11, 10, 11, 11, 10, 11, 10, 11, 12, 12, 11, 12, 13, 12
OFFSET
1,2
COMMENTS
General property:
Let b(0) < b(1) < b(2) < ... be an infinite sequence of strictly positive integers. So there exists a unique integer k >= 1 such that:
b(k) < (b(0) + b(1) + ... + b(k))/k <= b(k+1). (See the reference.)
LINKS
International Mathematical Olympiad 2014 Problem No 1, Cape Town - South Africa.
EXAMPLE
a(3)=2 because the infinite sequence {b(0),b(1),b(2),...} = {prime(3),prime(4),...} = {5, 7, 11, 13, ...} => b(2) < (b(0) + b(1) + b(2))/2 <= b(3) => 11 < (5+7+11)/2 < 13 => 11 < 11.5 < 13. Hence a(3)=2.
MAPLE
for n from 1 to 80 do:
ii:=0:
for k from n+1 to 10^8 while(ii=0)do:
s:=sum('ithprime(i)', 'i'=n..k):s1:=evalf(s/(k-n)):
if s1<= ithprime(k+1) and s1>ithprime(k)
then
printf(`%d, `, k-n):ii:=1:
else
fi:
od:
od:
MATHEMATICA
lst={}; Do[k=n+1; While[Sum[Prime[j]/(k-n), {j, n, k}]>Prime[k+1]||Sum[Prime[j]/(k-n), {j, n, k}]<Prime[k], k++]; AppendTo[lst, k-n], {n, 1, 50}]; lst
PROG
(PARI) s=[]; for(n=1, 50, k=n+1; while(((sum(j=n, k, prime(j))/(k-n))>prime(k+1))||((sum(j=n, k, prime(j))/(k-n))<prime(k)), k++); s=concat(s, k-n)); s
CROSSREFS
Cf. A000040.
Sequence in context: A135034 A003059 A325678 * A192002 A263270 A337636
KEYWORD
nonn
AUTHOR
Michel Lagneau, Nov 23 2014
EXTENSIONS
Corrected by Michel Lagneau, Nov 20 2015
STATUS
approved