login
A284429
A quasilinear solution to Hofstadter's Q recurrence.
1
2, 1, 3, 5, 1, 3, 8, 1, 3, 11, 1, 3, 14, 1, 3, 17, 1, 3, 20, 1, 3, 23, 1, 3, 26, 1, 3, 29, 1, 3, 32, 1, 3, 35, 1, 3, 38, 1, 3, 41, 1, 3, 44, 1, 3, 47, 1, 3, 50, 1, 3, 53, 1, 3, 56, 1, 3, 59, 1, 3, 62, 1, 3, 65, 1, 3, 68, 1, 3, 71, 1, 3, 74, 1, 3
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.
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
A284429:=proc(n) option remember: if n <= 0 then 0: elif n = 1 then 2: elif n = 2 then 1: else A284429(n-A284429(n-1)) + A284429(n-A284429(n-2)): fi: end:
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