OFFSET
0,2
COMMENTS
Consider the general recurrence a(n) = k*a(n-1) + (5-2*k)*a(n-2) + (2-k)*a(n-3). The coefficients, in k, can be used to form the triple (k, 5-2*k, 2-k). Each triple is associated with a sequence, for example (0, 5, 2) leads to A111108, A112685, ..., (1, 3, 1) leads to A051927, A097075, ..., and so on. This sequence is formed from the triples {(0, 5, 2), (1, 3, 1), (2, 1, 0), (3, -1, -1), (4, -3, -2), ...}, for k >= 0. (Comment modified by G. C. Greubel, Dec 31 2023).
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (0,0,2,0,0,-1).
FORMULA
G.f.: x*(5+2*x+x^2-7*x^3-3*x^4) / ( (1-x)^2*(1+x+x^2)^2 ). - R. J. Mathar, Jul 06 2011
a(3n) = n.
a(3n+1) = 5 - 2*n.
a(3n+3) = 2 - n.
a(n) = (1/9)*( 27 - 2*(n+1) - 34*ChebyshevU(n, -1/2) + (-1)^n*(9*A099254(n) - 6*A099254(n-1)) ). - G. C. Greubel, Dec 26 2023
MATHEMATICA
LinearRecurrence[{0, 0, 2, 0, 0, -1}, {0, 5, 2, 1, 3, 1}, 60] (* Harvey P. Dale, Aug 16 2012 *)
Table[PadRight[{n, 5-2*n, 2-n}], {n, 0, 20}]//Flatten (* _G. C. Greubel, Dec 26 2023 *)
PROG
(PARI) Vec(x*(5+2*x+x^2-7*x^3-3*x^4)/((1-x)^2*(1+x+x^2)^2+O(x^99))) \\ Charles R Greathouse IV, Jul 06 2011
(Magma) I:=[0, 5, 2, 1, 3, 1]; [n le 6 select I[n] else 2*Self(n-3) - Self(n-6): n in [1..60]]; // G. C. Greubel, Dec 26 2023
(SageMath)
def a(n): # a = A136161
if n<6: return (0, 5, 2, 1, 3, 1)[n]
else: return 2*a(n-3) - a(n-6)
[a(n) for n in range(61)] # G. C. Greubel, Dec 26 2023
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Paul Curtz, Mar 16 2008
STATUS
approved