login
A249569
a(1) = a(2) = 1; for n > 2, a(n) = a(n-a(n-1)) + a(n-a(a(n-2))).
1
1, 1, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 10, 10, 12, 12, 13, 13, 14, 15, 15, 16, 16, 17, 19, 16, 19, 21, 19, 21, 21, 22, 23, 23, 25, 24, 25, 26, 26, 26, 29, 29, 27, 32, 26, 34, 31, 29, 36, 31, 36, 35, 34, 36, 37, 37, 37, 38, 38, 40, 40, 40, 41, 42, 42, 43, 46
OFFSET
1,3
COMMENTS
Dies if a(n) > n. Is the sequence defined for all positive n?
EXAMPLE
a(27) = 19 because a(26) = 17, a(25) = 16, a(16) = 10, and then a(27-17) + a(27-10) = a(10) + a(17) = 7 + 12 = 19.
MATHEMATICA
a249569[n_Integer] := Module[{k, t = Table[0, {n}]}, t[[1]] = t[[2]] = 1; Do[t[[k]] = t[[k - t[[k - 1]]]] + t[[k - t[[t[[k - 2]]]]]], {k, 3, n}]; t]; a249569[69] (* Michael De Vlieger, Nov 12 2014 *)
PROG
(Magma) I:=[1, 1]; [n le 2 select I[n] else Self(n-Self(n-1))+Self(n-Self(Self(n-2))): n in [1..69]];
(Haskell)
a249569 n = a249569_list !! (n-1)
a249569_list = 1 : 1 : zipWith (+)
(map a249569 $ zipWith (-) [3..] $ tail a249569_list)
(map a249569 $ zipWith (-) [3..] $ map a249569 a249569_list)
-- Reinhard Zumkeller, Nov 14 2014
CROSSREFS
Cf. A005185.
Sequence in context: A168389 A039708 A189730 * A094500 A049473 A154951
KEYWORD
nonn,easy
AUTHOR
STATUS
approved