cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A284429 A quasilinear solution to Hofstadter's Q recurrence.

Original entry on oeis.org

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

Views

Author

Nathan Fox, Mar 26 2017

Keywords

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.

Crossrefs

Programs

  • 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 *)
  • 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

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.