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!)
A226222 a(1) = a(2) = a(3) = 1, a(n) = a(n-2-a(n-2)) + a(n-1-a(n-3)) for n>3. 7

%I #10 Mar 29 2022 03:40:37

%S 1,1,1,2,2,3,3,3,4,5,5,5,6,6,7,7,8,9,9,9,10,10,11,11,11,12,13,13,13,

%T 14,15,16,16,16,17,18,18,18,18,19,20,21,21,21,21,22,22,23,23,24,25,25,

%U 25,26,26,27,27,28,29,30,30,30,31,32,32,32,32,33,35,35

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

%C First numbers not occurring: 62, 66, 75, 79, 114, 123, ... .

%H Reinhard Zumkeller, <a href="/A226222/b226222.txt">Table of n, a(n) for n = 1..10000</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/HofstadtersQ-Sequence.html">Hofstadter's Q-Sequence</a>

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Hofstadter_sequence">Hofstadter sequence</a>

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

%F a(n) = a(n-2 - a(n-2)) + a(n-1 - a(n-3)), with a(1) = a(2) = a(3) = 1.

%t a[n_]:= a[n]= If[n<4, 1, a[n-2 -a[n-2]] + a[n-1 -a[n-3]]];

%t Table[a[n], {n, 80}] (* _G. C. Greubel_, Mar 28 2022 *)

%o (Haskell)

%o a226222 n = a226222_list !! (n-1)

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

%o (map a226222 $ zipWith (-) [3..] a226222_list)

%o (map a226222 $ zipWith (-) [2..] $ tail a226222_list)

%o -- _Reinhard Zumkeller_, May 31 2013

%o (Sage)

%o @CachedFunction

%o def a(n): # A226222

%o if (n<4): return 1

%o else: return a(n-2-a(n-2)) + a(n-1-a(n-3))

%o [a(n) for n in (1..80)] # _G. C. Greubel_, Mar 28 2022

%Y Cf. A005185, A046699, A063892, A070867.

%K nonn,look

%O 1,4

%A _Reinhard Zumkeller_, May 31 2013

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 20 03:03 EDT 2024. Contains 371798 sequences. (Running on oeis4.)