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(n) = 0 if n <= 0; a(1) = 7, a(2) = 0, a(3) = 8, a(4) = 7, a(5) = 7, a(6) = 8, a(7) = 4.
This sequence is an interleaving of seven simpler sequences. Four are constant, two are linear polynomials, and one is a geometric sequence.
LINKS
Nathan Fox, Table of n, a(n) for n = 1..10000
Index entries for linear recurrences with constant coefficients, signature (0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, -5, 0, 0, 0, 0, 0, 0, 2).
FORMULA
a(7n) = 4, a(7n+1) = 7, a(7n+2) = 7n, a(7n+3) = 8n+8, a(7n+4) = 7, a(7n+5) = 7, a(7n+6) = 2^(n+3).
G.f.: (-8*x^20-8*x^19-14*x^18-14*x^17+14*x^15-14*x^14+12*x^13 +16*x^12 +21*x^11 +21*x^10+16*x^9-7*x^8+21*x^7-4*x^6-8*x^5-7*x^4-7*x^3 -8*x^2-7) / ((-1+2*x^7)*(-1+x)^2*(1+x+x^2+x^3+x^4+x^5+x^6)^2).
a(n) = 4*a(n-7) - 5*a(n-14) + 2*a(n-21) for n > 21.
MAPLE
CROSSREFS
KEYWORD
nonn
AUTHOR
Nathan Fox, Mar 19 2017
STATUS
approved