OFFSET
1,6
COMMENTS
This recursion is inspired by Ulam's early experiments in derivative recursions.
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,-2,1,-4,2).
FORMULA
G.f.: x*(1+2*x^2+x^3+5*x^4)/(1-x+2*x^2-x^3+4*x^4-2*x^5). - R. J. Mathar, Nov 18 2007
MAPLE
MATHEMATICA
a[n_]:= a[n]= If[n<6, 1, a[n-1] -2*a[n-2] +a[n-3] -2*(2*a[n-4] -a[n-5])];
Table[a[n], {n, 50}]
PROG
(SageMath)
@CachedFunction # a=A122581
def a(n): return 1 if (n<6) else a(n-1) -2*a(n-2) +a(n-3) -4*a(n-4) +2*a(n-5)
[a(n) for n in (1..50)] # G. C. Greubel, Nov 28 2021
(PARI) a(n)=([0, 1, 0, 0, 0; 0, 0, 1, 0, 0; 0, 0, 0, 1, 0; 0, 0, 0, 0, 1; 2, -4, 1, -2, 1]^(n-1)*[1; 1; 1; 1; 1])[1, 1] \\ Charles R Greathouse IV, May 20 2026
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Roger L. Bagula, Sep 19 2006
EXTENSIONS
Edited by N. J. A. Sloane, Oct 01 2006
More terms from R. J. Mathar, Sep 18 2007
STATUS
approved
