A071578 Number of iterations of Pi(n) needed to reach 1, where Pi(x) denotes the number of primes <= x.
0, 1, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
Offset: 1
Crossrefs
Cf. A000720.
Programs
-
Mathematica
Table[Length[NestWhileList[PrimePi[#]&,n,#!=1&]]-1,{n,110}] (* Harvey P. Dale, Dec 24 2018 *)
-
PARI
for(n=2,150,s=n; t=0; while(s!=1,t++; s=sum(i=2,s,isprime(i)); if(s==1,print1(t,","); ); ))
Formula
a(n) = a(Pi(n))+1.
a(n) = A060197(n) - 2. - Filip Zaludek, Dec 10 2016