OFFSET
1,6
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (-1,-1,-1,0,1).
FORMULA
G.f.: x*(1+2*x+3*x^2+4*x^3+4*x^4)/(1+x+x^2+x^3-x^5). - Colin Barker, Oct 19 2012
MATHEMATICA
M= {{0, 1, 0, 0, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 1}, {1, 0, -1, -1, -1}};
w[1] = {1, 1, 1, 1, 1}; w[n_]:= w[n]= M.w[n-1];
Table[w[n][[1]], {n, 60}]
LinearRecurrence[{-1, -1, -1, 0, 1}, {1, 1, 1, 1, 1}, 61] (* G. C. Greubel, Oct 26 2024 *)
PROG
(Magma) [n le 5 select 1 else -Self(n-1) -Self(n-2) -Self(n-3) +Self(n-5): n in [1..60]]; // G. C. Greubel, Oct 26 2024
(SageMath)
@CachedFunction # a = A122520
def a(n): return 1 if n<6 else -a(n-1) -a(n-2) -a(n-3) +a(n-5)
[a(n) for n in range(1, 61)] # G. C. Greubel, Oct 26 2024
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Roger L. Bagula, Sep 16 2006
EXTENSIONS
STATUS
approved