OFFSET
0,2
LINKS
B. Berselli, Table of n, a(n) for n = 0..10000.
Index entries for linear recurrences with constant coefficients, signature (1,0,1,-1).
FORMULA
G.f.: (1 +3*x +5*x^3)/((1-x)^2*(1+x+x^2)).
a(n) = a(n-1) +a(n-3) -a(n-4) for n>3.
a(n) = (n-1)*(n mod 3) +(n+1)*(n+1 mod 3) +n*(n+2 mod 3).
a(n) = 3*n +sqrt(3)*cos((4*n-3)*Pi/6) -sin((4*n-3)*Pi/6).
a(n) - a(n-1) = 3*A080425(n+1) for n>0.
From G. C. Greubel, Apr 06 2021: (Start)
a(n) = 3*n - 2*cos(2*Pi*(n+1)/3) = 3*n + A061347(n+1).
a(n) = 3*n + ChebyshevU(n, -1/2) + 2*ChebyshevU(n-1, -1/2). (End)
MAPLE
m:=60; S:=series( (1+3*x+5*x^3)/((1-x)^2*(1+x+x^2)), x, m+1):
seq(coeff(S, x, j), j=1..m); # G. C. Greubel, Apr 06 2021
MATHEMATICA
CoefficientList[Series[(1 +3x +5x^3)/((1-x)^2(1+x+x^2)), {x, 0, 60}], x] (* Vincenzo Librandi, Mar 26 2013 *)
LinearRecurrence[{1, 0, 1, -1}, {1, 4, 4, 10}, 60] (* Harvey P. Dale, Aug 05 2020 *)
PROG
(Magma) I:=[1, 4, 4, 10]; [n le 4 select I[n] else Self(n-1)+Self(n-3)-Self(n-4): n in [1..60]]; // Vincenzo Librandi, Mar 26 2013
(Sage) [3*n +chebyshev_U(n, -1/2) +2*chebyshev_U(n-1, -1/2) for n in (0..60)] # G. C. Greubel, Apr 06 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Bruno Berselli, Sep 28 2010 - Oct 01 2010
STATUS
approved