OFFSET
0,4
COMMENTS
The closely related partial sums of L(1) - F(1) + L(2) - F(2) + L(3) - F(3) + .... are given by A355019.
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,1,-1,1,-1).
FORMULA
a(n) = 2 - 2*F((n+3)/2) if n is odd, a(n) = 2 - F((n+2)/2) if n is even, where F = A000045 (Fibonacci numbers).
a(n) = a(n-1) + a(n-2) - a(n-3) + a(n-4) - a(n-5) for n >= 5.
G.f.: (1 - x - 2*x^3)/((1 - x)*(1 - x^2 - x^4)).
From G. C. Greubel, Mar 17 2024: (Start)
a(n) = (1/2)*Sum_{j=0..n} ( (1+(-1)^j)*Fibonacci(floor((j+3)/2)) - (1 - (-1)^j)*Lucas(floor((j+1)/2)) ).
a(n) = 2 - (1/2)*( (1+(-1)^n)*Fibonacci(floor((n+2)/2)) + 2*(1-(-1)^n)* Fibonacci(floor((n+3)/2)) ). (End)
EXAMPLE
a(0) = 1
a(1) = 1 - 1 = 0
a(2) = 1 - 1 + 1 = 1
a(3) = 1 - 1 + 1 - 3 = -2.
MATHEMATICA
f[n_] := Fibonacci[n]; g[n_] := LucasL[n];
f1[n_] := If[OddQ[n], 2 - 2 f[(n + 3)/2], 2 - f[(n + 2)/2]]
f2 = Table[f1[n], {n, 0, 20}] (* this sequence *)
g1[n_] := If[OddQ[n], -2 + 2 f[(n + 3)/2], -2 + f[(n + 8)/2]]
g2 = Table[g1[n], {n, 0, 20}] (* A355019 *)
LinearRecurrence[{1, 1, -1, 1, -1}, {1, 0, 1, -2, 0}, 61] (* G. C. Greubel, Mar 17 2024 *)
PROG
(Magma) F:=Fibonacci; [2 - (((n+1) mod 2)*F(Floor((n+2)/2)) + 2*(n mod 2)*F(Floor((n+3)/2))) : n in [0..60]]; // G. C. Greubel, Mar 17 2024
(SageMath) f=fibonacci; [2 - (((n+1)%2)*f(((n+2)//2)) +2*(n%2)*f((n+3)//2)) for n in range(61)] # G. C. Greubel, Mar 17 2024
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Clark Kimberling, Jun 16 2022
STATUS
approved