OFFSET
0,2
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (2,1,-3,0,1).
FORMULA
From Colin Barker, Jan 27 2017: (Start)
a(n) = 2*a(n-1) + a(n-2) - 3*a(n-3) + a(n-5) for n>4.
G.f.: (1 - x^2 + x^4) / ((1 - x)^2*(1 + x)*(1 - x - x^2)). (End)
0 = 3 + a(n)*(-4 - 2*a(n) - a(n+1) + 6*a(n+2) - a(n+3)) + a(n+1)*(-1 + a(n+1) + a(n+2) - 2*a(n+3)) + a(n+2)*(+11 - 5*a(n+2) + 3*a(n+3)) + a(n+3)*(-6) for all n in Z. - Michael Somos, Jan 27 2017
From G. C. Greubel, Apr 05 2024: (Start)
a(n) = 2*Fibonacci(n+2) - (1/4)*(2*n + 5 - (-1)^n).
E.g.f.: (1/2)*(4*exp(x/2)*(cosh(sqrt(5)*x/2) + (3/sqrt(5))*sinh( sqrt(5)*x/2)) - (x+2)*cosh(x) - (x+3)*sinh(x)). (End)
EXAMPLE
G.f. = 1 + 2*x + 4*x^2 + 7*x^3 + 13*x^4 + 22*x^5 + 38*x^6 + 63*x^7 + ...
MATHEMATICA
CoefficientList[Series[(1-x^2+x^4)/((1-x)^2*(1+x)*(1-x-x^2)), {x, 0, 50}], x] (* G. C. Greubel, Jul 29 2018 *)
PROG
(PARI) Vec((1-x^2+x^4)/((1-x)^2*(1+x)*(1-x-x^2)) + O(x^50))
(PARI) {a(n) = my(m=n); if( n<0, m=-1-n); polcoeff( (1 - x^2 + x^4) / ((1 - x - x^2 + x^3) * (1 - (-1)^(n<0)*x - x^2)) + x * O(x^m), m)}; /* Michael Somos, Jan 27 2017 */
(Magma) R<x>:=PowerSeriesRing(Integers(), 50); Coefficients(R!((1 - x^2+x^4)/((1-x)^2*(1+x)*(1-x-x^2)))); // G. C. Greubel, Jul 29 2018
(SageMath) [2*fibonacci(n+2) -(n+2+(n%2))//2 for n in range(51)] # G. C. Greubel, Apr 05 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved