login
a(0) = 1; a(n) = a(n-1) + (if n = a(k) for some k then k else n).
1

%I #4 Sep 26 2014 20:44:28

%S 0,1,3,5,9,12,18,25,33,37,47,58,63,76,90,105,121,138,144,163,183,204,

%T 226,249,273,280,306,333,361,390,420,451,483,491,525,560,596,605,643,

%U 682,722,763,805,848,892,937,983,993,1041,1090,1140,1191,1243,1296

%N a(0) = 1; a(n) = a(n-1) + (if n = a(k) for some k then k else n).

%C a(n) <= A000217(n).

%H Reinhard Zumkeller, <a href="/A247799/b247799.txt">Table of n, a(n) for n = 0..1000</a>

%o (Haskell)

%o import Data.List (elemIndex); import Data.Maybe (maybe)

%o a247799 n = a247799_list !! n

%o a247799_list = 0 : f 1 [0] where

%o f x zs@(z:_) = y : f (x + 1) (y : zs) where

%o y = z + maybe x id (elemIndex x $ reverse zs)

%Y Cf. A000217.

%K nonn

%O 0,3

%A _Reinhard Zumkeller_, Sep 26 2014