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!)
A025003 a(1) = 2; a(n+1) = a(n)-th nonprime, where nonprimes begin at 1. 4

%I #18 Sep 19 2020 09:00:18

%S 2,4,8,14,22,33,48,66,90,120,156,202,256,322,400,494,604,734,888,1067,

%T 1272,1512,1790,2107,2472,2890,3364,3903,4515,5207,5990,6875,7868,

%U 8984,10238,11637,13207,14959,16909,19075,21483,24173,27149,30436,34080,38103

%N a(1) = 2; a(n+1) = a(n)-th nonprime, where nonprimes begin at 1.

%C Index of first occurrence of n in A090532.

%C Let b(n) (n >= 0) be the smallest integer k >= 1 that takes n steps to reach 1 iterating the map f: k -> k - pi(k). The sequence {b(n), n >= 0} begins 1, 2, 4, 8, 14, 22, 33, 48, 66, 90, 120, 156, ... and agrees with the present sequence except for b(0). - _Ya-Ping Lu_, Sep 07 2020

%F a(n) = min(k: f^n(k) = 1), where f = A062298 and n-fold iteration of f is denoted by f^n. - _Ya-Ping Lu_, Sep 07 2020

%e From _Ya-Ping Lu_, Sep 07 2020: (Start)

%e a(1) = 2 because f(2) = 2 - pi(2) = 1 and m(2) = 1;

%e For the integer 3, since f(3) = 1. m(3) = 1, which is not bigger than m(1) or m(2). So, 3 is not a term in the sequence;

%e a(2) = 4 because f^2(4) = f(2) = 1 and m(4) = 2;

%e a(3) = 8 because f^3(8) = f^2(4) = 1 and m(8) = 3. (End)

%p N:= 50: # to get a(0)..a(N)

%p V:= Array(0..N):

%p V[0]:= 1: V[1]:= 2:

%p m:= 2: p:= 3: g:= 1: n:= 1:

%p do

%p if g+p-m-1 >= V[n] then

%p m:= V[n]+m-g;

%p n:= n+1;

%p V[n]:= m;

%p if n = N then break fi;

%p g:= V[n-1];

%p else

%p g:= g+p-m;

%p m:= p+1;

%p p:= nextprime(m);

%p fi;

%p od;

%p convert(V, list); # _Robert Israel_, Sep 08 2020

%o (Python)

%o from sympy import prime, primepi

%o n_last = 0

%o pi_last = 0

%o ct_max = -1

%o for n in range(1, 100001):

%o ct = 0

%o pi = pi_last + primepi(n) - primepi(n_last)

%o n_c = n

%o pi_c = pi

%o while n_c > 1:

%o nc -= pi_c

%o ct += 1

%o pi_c -= primepi(n_c + pi_c) - primepi(n_c)

%o if ct > ct_max:

%o print(n)

%o ct_max = ct

%o n_last = n

%o pi_last = pi # _Ya-Ping Lu_, Sep 07 2020

%Y Cf. A000040, A000720, A014688, A014689, A062298, A090532, A332086, A337334.

%K nonn

%O 1,1

%A _David W. Wilson_

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 April 19 06:16 EDT 2024. Contains 371782 sequences. (Running on oeis4.)