OFFSET
0,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (4,-4).
FORMULA
From Michael Somos, Aug 19 2014: (Start)
a(n) = 2^n for all n<4.
a(n) = 2^n - (n-3) * 2^(n-4) for all n>=4.
a(n) = 4*(a(n-1) - a(n-2)) for all n in Z except n=4.
a(n) = 2*a(n-1) - 2^(n-4).
0 = a(n)*(-8*a(n+1) + 8*a(n+2) - 2*a(n+3)) + a(n+1)*(+4*a(n+1) - 4*a(n+2) + a(n+3)) for all n in Z. (End)
E.g.f.: ( -3 -4*x -2*x^2 + (19 - 2*x)*exp(2*x) )/16. - G. C. Greubel, Sep 13 2019
EXAMPLE
G.f. = 1 + 2*x + 4*x^2 + 8*x^3 + 15*x^4 + 28*x^5 + 52*x^6 + 96*x^7 + 176*x^8 + ...
MATHEMATICA
a[ n_]:= 2^n - 2^(n-4) Max[0, n-3]; (* Michael Somos, Aug 19 2014 *)
Table[If[n < 4, 2^n, 2^(n-4)*(19 - n)], {n, 0, 40}] (* G. C. Greubel, Sep 13 2019 *)
PROG
(PARI) {a(n) = 2^n - 2^(n-4) * max(n-3, 0)}; /* Michael Somos, Jan 12 2000 */
(PARI) Vec((1-2*x-x^4)/(1-2*x)^2 +O(x^40)) \\ Charles R Greathouse IV, Sep 26 2012
(Magma) [n lt 4 select 2^n else 2^(n-4)*(19-n): n in [0..40]]; // G. C. Greubel, Sep 13 2019
(Sage) [1, 2, 4, 8]+[2^(n-4)*(19 - n) for n in (4..40)] # G. C. Greubel, Sep 13 2019
(GAP) a:=[1, 2];; for n in [3..40] do a[n]:=4*(a[n-1]-a[n-2]); od; a; # G. C. Greubel, Sep 13 2019
CROSSREFS
KEYWORD
sign,easy
AUTHOR
N. J. A. Sloane, Alejandro Teruel (teruel(AT)usb.ve)
EXTENSIONS
Better description from Michael Somos, Jan 12 2000
More terms added by G. C. Greubel, Sep 13 2019
STATUS
approved