%I
%S 1,2,4,7,12,18,26,36,48,64,83,107,136,169,209,256,311,376,451,539,639,
%T 755,889,1044,1220,1420,1644,1904,2196,2524,2894,3313,3780,4307,4898,
%U 5553,6286,7104,8015,9025,10147,11393,12769,14293,15971,17832
%N a(1) = 1, a(n) = a(n  1) + pi(a(n  1)) + 1.
%C 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]
%e a(4) = 7 because a(3) = 4 and 4 + pi(4) + 1 = 4 + 2 + 1 = 7.
%e a(5) = 12 because a(4) = 7 and 7 + pi(7) + 1 = 7 + 4 + 1 = 12.
%t g[ n_Integer ] := (k = n + PrimePi[ n ] + 1; While[ k  PrimePi[ k ]  1, k++ ]; k); NestList[ g, 1, 50 ]
%t NestList[#+PrimePi[#]+1&,1,50] (* _Harvey P. Dale_, Feb 13 2016 *)
%Y Cf. A000720
%K nonn,easy
%O 1,2
%A _Labos Elemer_, Dec 08 2001
