login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A249569 a(1) = a(2) = 1; for n > 2, a(n) = a(n-a(n-1)) + a(n-a(a(n-2))). 1

%I #24 Sep 08 2022 08:46:10

%S 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,

%T 16,19,21,19,21,21,22,23,23,25,24,25,26,26,26,29,29,27,32,26,34,31,29,

%U 36,31,36,35,34,36,37,37,37,38,38,40,40,40,41,42,42,43,46

%N a(1) = a(2) = 1; for n > 2, a(n) = a(n-a(n-1)) + a(n-a(a(n-2))).

%C Dies if a(n) > n. Is the sequence defined for all positive n?

%H Reinhard Zumkeller, <a href="/A249569/b249569.txt">Table of n, a(n) for n = 1..100000</a>

%H <a href="/index/Ho#Hofstadter">Index entries for Hofstadter-type sequences</a>

%e 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.

%t 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 *)

%o (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]];

%o (Haskell)

%o a249569 n = a249569_list !! (n-1)

%o a249569_list = 1 : 1 : zipWith (+)

%o (map a249569 $ zipWith (-) [3..] $ tail a249569_list)

%o (map a249569 $ zipWith (-) [3..] $ map a249569 a249569_list)

%o -- _Reinhard Zumkeller_, Nov 14 2014

%Y Cf. A005185.

%K nonn,easy

%O 1,3

%A _Arkadiusz Wesolowski_, Nov 10 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 19:02 EDT 2024. Contains 371798 sequences. (Running on oeis4.)