OFFSET
0,2
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(n) = 0 if n <= 0; a(1) = 2, a(2) = 2.
This sequence is the same as A133265 with the leading 2 changed to a 0.
LINKS
Nathan Fox, Table of n, a(n) for n = 0..1000
Nathan Fox, Finding Linear-Recurrent Solutions to Hofstadter-Like Recurrences Using Symbolic Computation, arXiv:1609.06342 [math.NT], 2016.
Index entries for linear recurrences with constant coefficients, signature (0,2,0,-1).
FORMULA
a(0) = 0; thereafter, a(2n) = 2, a(2n+1) = 2n+2.
a(n) = 2*a(n-2) - a(n-4) for n>4.
G.f.: -(2*x^3 -2*x -2)/((x-1)^2*(x+1)^2).
MATHEMATICA
Join[{0}, LinearRecurrence[{0, 2, 0, -1}, {2, 2, 4, 2}, 73]] (* Jean-François Alcover, Feb 19 2019 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Nathan Fox, Jul 24 2016
STATUS
approved