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
2, 4, 8, 14, 22, 33, 48, 66, 90, 120, 156, 202, 256, 322, 400, 494, 604, 734, 888, 1067, 1272, 1512, 1790, 2107, 2472, 2890, 3364, 3903, 4515, 5207, 5990, 6875, 7868, 8984, 10238, 11637, 13207, 14959, 16909, 19075, 21483, 24173, 27149, 30436, 34080, 38103 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

COMMENTS

Index of first occurrence of n in A090532.

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

LINKS

Table of n, a(n) for n=1..46.

FORMULA

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

EXAMPLE

From Ya-Ping Lu, Sep 07 2020: (Start)

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

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;

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

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

MAPLE

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

V:= Array(0..N):

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

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

do

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

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

    n:= n+1;

    V[n]:= m;

    if n = N then break fi;

    g:= V[n-1];

  else

    g:= g+p-m;

    m:= p+1;

    p:= nextprime(m);

  fi;

od;

convert(V, list); # Robert Israel, Sep 08 2020

PROG

(Python)

from sympy import prime, primepi

n_last = 0

pi_last = 0

ct_max = -1

for n in range(1, 100001):

    ct = 0

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

    n_c = n

    pi_c = pi

    while n_c > 1:

        nc -= pi_c

        ct += 1

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

    if ct > ct_max:

        print(n)

        ct_max = ct

    n_last = n

    pi_last = pi # Ya-Ping Lu, Sep 07 2020

CROSSREFS

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

Sequence in context: A025196 A084626 A090533 * A087151 A053798 A305497

Adjacent sequences:  A025000 A025001 A025002 * A025004 A025005 A025006

KEYWORD

nonn

AUTHOR

David W. Wilson

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 August 10 16:03 EDT 2022. Contains 356039 sequences. (Running on oeis4.)