login
a(n) = a(n-1)+a(n-2), n>1 ; a(0)=1, a(1)=-1.
8

%I #45 Dec 31 2023 10:30:08

%S 1,-1,0,-1,-1,-2,-3,-5,-8,-13,-21,-34,-55,-89,-144,-233,-377,-610,

%T -987,-1597,-2584,-4181,-6765,-10946,-17711,-28657,-46368,-75025,

%U -121393,-196418,-317811,-514229,-832040,-1346269,-2178309,-3524578,-5702887

%N a(n) = a(n-1)+a(n-2), n>1 ; a(0)=1, a(1)=-1.

%H Vincenzo Librandi, <a href="/A152163/b152163.txt">Table of n, a(n) for n = 0..1000</a>

%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (1,1).

%F G.f.: (1-2*x)/(1-x-x^2).

%F a(n) = Sum_{k, 0<=k<=n}A147703(n,k)*(-2)^k.

%F a(n) = -Fibonacci(n-2) for n >= 2, and for all n if A000045 is extended in the natural way to negative indices; see also A039834. [Extended by _M. F. Hasler_, May 10 2017]

%F a(n) = (-1)^n*A039834(n-2). - _R. J. Mathar_, Mar 22 2011

%F G.f.: (1/(1-Q(0))-1)*(1-2*x)/x where Q(k)=1 - x^k/(1 - x/( x - x^k/Q(k+1) )); (continued fraction). - _Sergei N. Gladkovskii_, Feb 23 2013

%F G.f.: 2 - 2/(Q(0)+1) where Q(k) = 1 - 2*x/(1 - x/(x - 1/Q(k+1) )); (continued fraction ). - _Sergei N. Gladkovskii_, Apr 05 2013

%F a(n) = A000045(n+1)-2*A000045(n). - _R. J. Mathar_, Jun 26 2013

%F G.f.: 1 - x - x^3*Q(0)/2, where Q(k) = 1 + 1/(1 - x*(6*k+1 + x)/(x*(6*k+4 + x) + 1/Q(k+1) )); (continued fraction). - _Sergei N. Gladkovskii_, Jan 02 2014

%F G.f.: 1+1/x - x - Q(0)/x, where Q(k) = 1 + x^2 - x^3 - k*x*(1+x^2) - x^2*( x*(k+2)-1)*( k*x -1)/Q(k+1) ; (continued fraction). - _Sergei N. Gladkovskii_, Jan 13 2014

%t LinearRecurrence[{1,1},{1,-1},40] (* _Harvey P. Dale_, Oct 09 2012 *)

%o (Magma) I:=[1, -1]; [n le 2 select I[n] else Self(n-1)+Self(n-2): n in [1..40]]; // _Vincenzo Librandi_, Feb 23 2013

%o (PARI) a(n)=-fibonacci(n-2) \\ _M. F. Hasler_, May 10 2017

%o (Sage)

%o def A152163():

%o a, b = True, False

%o x, y = 1, 1

%o while True:

%o yield x if a else -x

%o x, y = y, x - y

%o a, b = b, a

%o a = A152163()

%o print([next(a) for _ in range(50)]) # _Peter Luschny_, Mar 19 2020

%Y Cf. A000045.

%K easy,sign

%O 0,6

%A _Philippe Deléham_, Nov 27 2008