OFFSET
1,1
COMMENTS
A quasi-periodic solution to the three-term Hofstadter recurrence a(n) = a(n-a(n-1)) + a(n-a(n-2)) + a(n-a(n-3)). For a quasi-quadratic solution, see also A268368 that uses the convention that evaluating at a nonpositive index gives zero (this sequence and A244477 do not use this convention). See page 119 at the Fox reference for the detailed analysis of solutions with initial conditions with 1 through N. The three-term Hofstadter recurrence also has a slow solution (A278055) and chaotic solutions such as A292351, A296413 and A296440. So the recurrence a(n) = a(n-a(n-1)) + a(n-a(n-2)) + a(n-a(n-3)) has all known types of behaviors that are mentioned on page 7 of the Tanny reference in the Links section.
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Altug Alkan, On a conjecture about generalized Q-recurrence, Open Mathematics (2018) Vol. 16, Issue 1, 1490-1500.
Nathan Fox, An exploration of nested recurrences using experimental mathematics, Ph.D. thesis, 2017 (19 MB).
Steve Tanny, An Invitation to Nested Recurrence Relations, Slides of talk presented at CanaDAM 2013.
Index entries for linear recurrences with constant coefficients, signature (0,0,0,2,0,0,0,-1).
FORMULA
a(4*k) = a(4*k+1) = a(4*k+3) = 4*k, a(4*k+2) = 4 for k > 1.
From Colin Barker, Dec 14 2017: (Start)
G.f.: x*(3 + x + 2*x^2 + 2*x^3 - 5*x^4 + 4*x^7 + 9*x^8 + x^9 + 2*x^10 - 2*x^11 - 3*x^12 - 2*x^13) / ((1 - x)^2*(1 + x)^2*(1 + x^2)^2).
a(n) = 2*a(n-4) - a(n-8) for n > 14.
(End)
MAPLE
a:= proc(n) option remember; procname(n-procname(n-1))+procname(n-procname(n-2))+procname(n-procname(n-3)) end proc:
a(1):= 3: a(2):= 1: a(3):= 2: a(4):= 2: a(5):= 1: a(6):= 2:
map(a, [$1..100]); # after Robert Israel at A296440
MATHEMATICA
Fold[Append[#1, #1[[#2 - #1[[#2 - 1]] ]] + #1[[#2 - #1[[#2 - 2]] ]] + #1[[#2 - #1[[#2 - 3]] ]] ] &, {3, 1, 2, 2, 1, 2}, Range[7, 90]] (* or *)
Rest@ CoefficientList[Series[x (3 + x + 2 x^2 + 2 x^3 - 5 x^4 + 4 x^7 + 9 x^8 + x^9 + 2 x^10 - 2 x^11 - 3 x^12 - 2 x^13)/((1 - x)^2*(1 + x)^2*(1 + x^2)^2), {x, 0, 90}], x] (* Michael De Vlieger, Dec 14 2017 *)
LinearRecurrence[{0, 0, 0, 2, 0, 0, 0, -1}, {3, 1, 2, 2, 1, 2, 4, 8, 8, 4, 8, 12, 12, 4}, 100] (* Harvey P. Dale, May 30 2018 *)
PROG
(PARI) q=vector(10^5); q[1]=3; q[2]=1; q[3]=2; q[4]=2; q[5]=1; q[6]=2; for(n=7, #q, q[n] = q[n-q[n-1]]+q[n-q[n-2]]+q[n-q[n-3]]); q
(PARI) Vec(x*(3 + x + 2*x^2 + 2*x^3 - 5*x^4 + 4*x^7 + 9*x^8 + x^9 + 2*x^10 - 2*x^11 - 3*x^12 - 2*x^13) / ((1 - x)^2*(1 + x)^2*(1 + x^2)^2) + O(x^100)) \\ Colin Barker, Dec 14 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Altug Alkan, Dec 14 2017
STATUS
approved