login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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 (list; graph; refs; listen; history; text; internal format)
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

Michel Lagneau, Table of n, a(n) for n = 1..10000

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

Adjacent sequences:  A247186 A247187 A247188 * A247190 A247191 A247192

KEYWORD

nonn

AUTHOR

Michel Lagneau, Nov 23 2014

EXTENSIONS

Corrected by Michel Lagneau, Nov 20 2015

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 25 13:00 EDT 2022. Contains 354071 sequences. (Running on oeis4.)