OFFSET
0,3
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,-1,2,2).
FORMULA
a(n) = a(n-1) - a(n-2) + 2*a(n-3) + 2*a(n-4) for n > 3. - Colin Barker, May 18 2019
From G. C. Greubel, Aug 24 2025: (Start)
a(n) = A000045(n+1) - (-1)^floor((n-1)/2) * (n mod 2) * 2^floor(n/2).
E.g.f.: exp(x/2)*(cosh(sqrt(5)*x/2) + (1/sqrt(5))*sinh(sqrt(5)*x/2)) - sin(sqrt(2)*x)/sqrt(2). (End)
MATHEMATICA
CoefficientList[Series[(1-x+3x^2+x^3)/((1-x-x^2)(1+2x^2)), {x, 0, 100}], x] (* or *) LinearRecurrence[{1, -1, 2, 2}, {1, 0, 2, 5}, 100] (* Harvey P. Dale, May 14 2022 *)
Table[Fibonacci[n+1] -I^(n-1)*Mod[n, 2]*2^Floor[n/2], {n, 0, 50}] (* G. C. Greubel, Aug 24 2025 *)
PROG
(PARI) Vec((1-x +3*x^2 +x^3)/((1-x-x^2)*(1+2*x^2)) + O(x^40)) \\ Colin Barker, May 18 2019
(Magma)
A116698:= func< n | Fibonacci(n+1) -((n mod 2) -2*0^((n+1) mod 4))*2^Floor(n/2) >;
[A116698(n): n in [0..50]]; // G. C. Greubel, Aug 24 2025
(SageMath)
def A116698(n): return fibonacci(n+1) - (-1)**((n-1)//2)*(n%2)*2**(n//2)
print([A116698(n) for n in range(51)]) # G. C. Greubel, Aug 24 2025
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Creighton Dement, Feb 23 2006
STATUS
approved
