OFFSET
1,1
COMMENTS
a(n) is the solution to the recurrence relation a(n) = a(n-a(n-1)) +a(n-a(n-2)) [Hofstadter's Q recurrence], with the initial conditions: a(1) = 2, a(2) = 1.
This sequence is a close relative of A283878.
LINKS
Nathan Fox, Table of n, a(n) for n = 1..10000
Index entries for linear recurrences with constant coefficients, signature (0, 0, 2, 0, 0, -1).
FORMULA
G.f.: (-3*x^5 - x^4 + x^3 + 3*x^2 + x + 2) / ((-1 + x)^2*(1 + x + x^2)^2).
a(n) = 2*a(n-3) - a(n-6) for n > 6.
a(3*k) = 3,
a(3*k+1) = 3*k+2,
a(3*k+2) = 1.
MAPLE
MATHEMATICA
CoefficientList[Series[(-3*x^5 - x^4 + x^3 + 3*x^2 + x + 2) / ((-1 + x)^2*(1 + x + x^2)^2), {x, 0, 100}], x] (* Indranil Ghosh, Mar 27 2017 *)
PROG
(PARI) Vec((-3*x^5 - x^4 + x^3 + 3*x^2 + x + 2) / ((-1 + x)^2*(1 + x + x^2)^2) + O(x^100)) \\ Indranil Ghosh, Mar 27 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Nathan Fox, Mar 26 2017
STATUS
approved