A244477 a(1)=3, a(2)=2, a(3)=1; thereafter a(n) = a(n-a(n-1)) + a(n-a(n-2)).
3, 2, 1, 3, 5, 4, 3, 8, 7, 3, 11, 10, 3, 14, 13, 3, 17, 16, 3, 20, 19, 3, 23, 22, 3, 26, 25, 3, 29, 28, 3, 32, 31, 3, 35, 34, 3, 38, 37, 3, 41, 40, 3, 44, 43, 3, 47, 46, 3, 50, 49, 3, 53, 52, 3, 56, 55, 3, 59, 58, 3, 62, 61, 3, 65, 64, 3, 68, 67, 3, 71, 70, 3, 74, 73, 3, 77, 76, 3, 80
Offset: 1
References
- Higham, J.; Tanny, S. More well-behaved meta-Fibonacci sequences. Proceedings of the Twenty-fourth Southeastern International Conference on Combinatorics, Graph Theory, and Computing (Boca Raton, FL, 1993). Congr. Numer. 98(1993), 3-17.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
- Altug Alkan, Nathan Fox, and Orhan Ozgur Aybar, On Hofstadter Heart Sequences, Complexity, Volume 2017, Article ID 2614163, 8 pages.
- Nathan Fox, Linear-Recurrent Solutions to Meta-Fibonacci Recurrences, Part 1 (video), Rutgers Experimental Math Seminar, Oct 01 2015. Part 2 is vimeo.com/141111991.
- S. W. Golomb, Discrete chaos: sequences satisfying "strange" recursions, unpublished manuscript, circa 1990 [cached copy, with permission (annotated)]
- Index entries for Hofstadter-type sequences
- Index entries for linear recurrences with constant coefficients, signature (0, 0, 2, 0, 0, -1).
Programs
-
Haskell
a244477 n = a244477_list !! (n-1) a244477_list = 3 : 2 : 1 : zipWith (+) (map a244477 $ zipWith (-) [4..] $ tail a244477_list) (map a244477 $ zipWith (-) [4..] $ drop 2 a244477_list) -- Reinhard Zumkeller, Jul 05 2014
-
Magma
[n le 3 select 4-n else Self(n-Self(n-1)) + Self(n-Self(n-2)): n in [1..80]]; // Vincenzo Librandi, Nov 24 2015
-
Maple
f := proc(n) option remember; if n<=3 then 4-n elif n > procname(n-1) and n > procname(n-2) then RETURN(procname(n-procname(n-1))+procname(n-procname(n-2))); else ERROR(" died at n= ", n); fi; end proc; [seq(f(n),n=0..200)];
-
Mathematica
a[1] = 3; a[2] = 2; a[3] = 1; a[n_] := a[n] = a[n - a[n - 1]] + a[n - a[n - 2]]; Array[a, 75] (* or *) Flatten@ Table[{Mod[3n, 3] +3, 3n -1, 3n -2}, {n, 25}] (* Robert G. Wilson v, Nov 23 2015 *)
Formula
From Colin Barker, Nov 23 2015: (Start)
a(n) = 2*a(n-3) - a(n-6) for n>6.
G.f.: x*(2*x^5 + x^4 - 3*x^3 + x^2 + 2*x + 3)/((x - 1)^2*(x^2 + x + 1)^2). (End)
a(3*k) = 3*k-2, a(3*k+1) = 3, a(3*k+2) = 3*k+2. - Nathan Fox, Apr 02 2017
a(n) = 3*(m-1)^2*floor(n/3) - (3*m^2-8*m+2), where m = n mod 3. - Luce ETIENNE, Oct 17 2018
Comments