OFFSET
1,4
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (3,-5,2).
FORMULA
a(n) = a(n-1) - Sum_{k=2..n-1} k*a(n-k), with a(1) = a(2) = 1, a(3) = -1.
G.f.: x*(1 - x)^2/(1 - 3*x + 5*x^2 - 2*x^3). - corrected by R. J. Mathar, Aug 22 2008
a(n) = 3*a(n-1) - 5*a(n-2) + 2*a(n-3). - G. C. Greubel, Sep 03 2021
MATHEMATICA
LinearRecurrence[{3, -5, 2}, {1, 1, -1}, 40] (* G. C. Greubel, Sep 03 2021 *)
PROG
(Magma) I:=[1, 1, -1]; [n le 3 select I[n] else 3*Self(n-1) - 5*Self(n-2) + 2*Self(n-3): n in [1..41]]; // G. C. Greubel, Sep 03 2021
(SageMath)
def A106540_list(prec):
P.<x> = PowerSeriesRing(ZZ, prec)
return P( x*(1-x)^2/(1-3*x+5*x^2-2*x^3) ).list()
a=A106540_list(41); a[1:] # G. C. Greubel, Sep 03 2021
CROSSREFS
KEYWORD
easy,sign
AUTHOR
Alexandre Wajnberg, May 08 2005
EXTENSIONS
Extended beyond a(14) by R. J. Mathar, Aug 22 2008
STATUS
approved
