A051792 a(n) = (-1)^(n-1)*(a(n-1) - a(n-2)), a(1)=1, a(2)=1.
1, 1, 0, 1, 1, 0, -1, 1, 2, -1, -3, 2, 5, -3, -8, 5, 13, -8, -21, 13, 34, -21, -55, 34, 89, -55, -144, 89, 233, -144, -377, 233, 610, -377, -987, 610, 1597, -987, -2584, 1597, 4181, -2584, -6765, 4181, 10946, -6765, -17711, 10946, 28657, -17711, -46368
Offset: 1
Links
- G. C. Greubel, Table of n, a(n) for n = 1..1000
- Index entries for two-way infinite sequences
- Index entries for linear recurrences with constant coefficients, signature (0,-1,0,1).
Programs
-
Magma
[Fibonacci(1 -Floor((n-4)/2) -2*((n-4) mod 2)): n in [1..60]]; // G. C. Greubel, Dec 06 2022
-
Mathematica
LinearRecurrence[{0,-1,0,1},{1,1,0,1},60] (* Harvey P. Dale, May 08 2017 *)
-
PARI
a(n)=fibonacci((3-n)\2+(3-n)%2*2)
-
Sage
def A051792(): x, y, b = 1, 1, true while True: yield x x, y = y, x - y y = -y if b else y b = not b a = A051792() print([next(a) for in range(51)]) # _Peter Luschny, Mar 19 2020
Formula
a(3-n) = A053602(n).
From Michael Somos: (Start)
G.f.: x*(1 + x + x^2 + 2*x^3)/(1 + x^2 - x^4).
a(n) = -a(n-2) + a(n-4). (End)
a(n) = b(n-1) + b(n-2) + b(n-3) + 2*b(n-4), where b(n) = i^n * A079977(n). - G. C. Greubel, Dec 06 2022