OFFSET
1,2
COMMENTS
Labos came up with this sequence when trying to write a Mathematica program for A006508. The entire loop "While[ k - PrimePi[ k ] - 1, k++ ]" is meaningless; all the function g[n] really does is add up n + pi(n) + 1 and then NestList makes the recurrence happen. [Alonso del Arte, Oct 25 2011]
EXAMPLE
a(4) = 7 because a(3) = 4 and 4 + pi(4) + 1 = 4 + 2 + 1 = 7.
a(5) = 12 because a(4) = 7 and 7 + pi(7) + 1 = 7 + 4 + 1 = 12.
MATHEMATICA
g[ n_Integer ] := (k = n + PrimePi[ n ] + 1; While[ k - PrimePi[ k ] - 1, k++ ]; k); NestList[ g, 1, 50 ]
NestList[#+PrimePi[#]+1&, 1, 50] (* Harvey P. Dale, Feb 13 2016 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Labos Elemer, Dec 08 2001
STATUS
approved