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.
%I A025003 #18 Sep 19 2020 09:00:18 %S A025003 2,4,8,14,22,33,48,66,90,120,156,202,256,322,400,494,604,734,888,1067, %T A025003 1272,1512,1790,2107,2472,2890,3364,3903,4515,5207,5990,6875,7868, %U A025003 8984,10238,11637,13207,14959,16909,19075,21483,24173,27149,30436,34080,38103 %N A025003 a(1) = 2; a(n+1) = a(n)-th nonprime, where nonprimes begin at 1. %C A025003 Index of first occurrence of n in A090532. %C A025003 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 A025003 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 A025003 From _Ya-Ping Lu_, Sep 07 2020: (Start) %e A025003 a(1) = 2 because f(2) = 2 - pi(2) = 1 and m(2) = 1; %e A025003 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 A025003 a(2) = 4 because f^2(4) = f(2) = 1 and m(4) = 2; %e A025003 a(3) = 8 because f^3(8) = f^2(4) = 1 and m(8) = 3. (End) %p A025003 N:= 50: # to get a(0)..a(N) %p A025003 V:= Array(0..N): %p A025003 V[0]:= 1: V[1]:= 2: %p A025003 m:= 2: p:= 3: g:= 1: n:= 1: %p A025003 do %p A025003 if g+p-m-1 >= V[n] then %p A025003 m:= V[n]+m-g; %p A025003 n:= n+1; %p A025003 V[n]:= m; %p A025003 if n = N then break fi; %p A025003 g:= V[n-1]; %p A025003 else %p A025003 g:= g+p-m; %p A025003 m:= p+1; %p A025003 p:= nextprime(m); %p A025003 fi; %p A025003 od; %p A025003 convert(V, list); # _Robert Israel_, Sep 08 2020 %o A025003 (Python) %o A025003 from sympy import prime, primepi %o A025003 n_last = 0 %o A025003 pi_last = 0 %o A025003 ct_max = -1 %o A025003 for n in range(1, 100001): %o A025003 ct = 0 %o A025003 pi = pi_last + primepi(n) - primepi(n_last) %o A025003 n_c = n %o A025003 pi_c = pi %o A025003 while n_c > 1: %o A025003 nc -= pi_c %o A025003 ct += 1 %o A025003 pi_c -= primepi(n_c + pi_c) - primepi(n_c) %o A025003 if ct > ct_max: %o A025003 print(n) %o A025003 ct_max = ct %o A025003 n_last = n %o A025003 pi_last = pi # _Ya-Ping Lu_, Sep 07 2020 %Y A025003 Cf. A000040, A000720, A014688, A014689, A062298, A090532, A332086, A337334. %K A025003 nonn %O A025003 1,1 %A A025003 _David W. Wilson_