OFFSET
1,2
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..1002
B. Balamohan, A. Kuznetsov and S. Tanny, On the behavior of a variant of Hofstadter's Q-sequence, J. Integer Sequences, Vol. 10 (2007), #07.7.1.
Index entries for linear recurrences with constant coefficients, signature (3, -2, 0, 0, 1, -3, 2).
FORMULA
From Chai Wah Wu, May 17 2017: (Start)
a(n) = 3*a(n-1) - 2*a(n-2) + a(n-5) - 3*a(n-6) + 2*a(n-7) for n > 8.
G.f.: x*(-5*x^7 + x^6 - x^5 - x^4 - x^3 + 3*x^2 - 2*x - 1)/((x - 1)^2*(2*x - 1)*(x^4 + x^3 + x^2 + x + 1)). (End)
PROG
(Python)
from __future__ import division
def A132174(n):
if n == 1:
return 1
if n == 2:
return 5
h, m = divmod(n - 3, 5)
return (382*2**(5*h + m)-10*2**m)//31- 7*h - m -(1 if m==3 else (-1 if m==4 else 2)) # Chai Wah Wu, May 17 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Nov 07 2007
EXTENSIONS
More terms from Chai Wah Wu, May 17 2017
STATUS
approved