login
A065962
a(1) = 1, a(n) = a(n - 1) + pi(a(n - 1)) + 1.
0
1, 2, 4, 7, 12, 18, 26, 36, 48, 64, 83, 107, 136, 169, 209, 256, 311, 376, 451, 539, 639, 755, 889, 1044, 1220, 1420, 1644, 1904, 2196, 2524, 2894, 3313, 3780, 4307, 4898, 5553, 6286, 7104, 8015, 9025, 10147, 11393, 12769, 14293, 15971, 17832
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
Sequence in context: A135901 A124197 A011909 * A173722 A049703 A175812
KEYWORD
nonn,easy
AUTHOR
Labos Elemer, Dec 08 2001
STATUS
approved