%I #67 Feb 02 2023 15:30:37
%S 1,-2,5,-12,29,-70,169,-408,985,-2378,5741,-13860,33461,-80782,195025,
%T -470832,1136689,-2744210,6625109,-15994428,38613965,-93222358,
%U 225058681,-543339720,1311738121,-3166815962,7645370045,-18457556052,44560482149,-107578520350,259717522849
%N Expansion of 1/(1 + 2*x - x^2).
%C Pisano period lengths: 1, 2, 8, 4, 12, 8, 6, 8, 24, 12, 24, 8, 28, 6, 24, 16, 16, 24, 40, 12, ... (is this A175181?) - _R. J. Mathar_, Aug 10 2012
%C The sequence 0, 1, -2, 5, -12, 29, -70, 169, -408, 985, ... with a leading 0 is the Lucas U(-2,-1)-sequence. - _R. J. Mathar_, Jan 08 2013
%C a(n) is the irrational part of the Q(sqrt(2)) integer (sqrt(2) - 1)^n = A123335(n) + a(n-1)*sqrt(2), with a(-1) = 0. - _Wolfdieter Lang_, Dec 07 2014
%C 3^n*a(n-1) = A251733(n), with a(-1) = 0, is the
%C irrational part of the Q(sqrt(2)) integer giving the length of a variant of Lévy's C-curve at iteration step n. - _Wolfdieter Lang_, Dec 07 2014
%H Vincenzo Librandi, <a href="/A077985/b077985.txt">Table of n, a(n) for n = 0..1000</a>
%H M. Janjic, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL13/Janjic/janjic33.html">Hessenberg Matrices and Integer Sequences </a>, J. Int. Seq. 13 (2010) # 10.7.8.
%H Tanya Khovanova, <a href="http://www.tanyakhovanova.com/RecursiveSequences/RecursiveSequences.html">Recursive Sequences</a>
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Lucas_sequence#Specific_names">Lucas sequence</a>
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (-2,1).
%H <a href="/index/Lu#Lucas">Index to Lucas sequences</a>
%F a(n) = (-1)^n * A000129(n+1). - _M. F. Hasler_, Oct 05 2008
%F a(0)=1, a(1)=-2, a(n) = -2*a(n-1) + a(n-2) for n>1. - _Philippe Deléham_, Sep 19 2009
%F G.f.: 1/(2+Q(0)), where Q(k)= 3*x - 1 + x*k + x*(1-x)*(k+1)/Q(k+1); (continued fraction). - _Sergei N. Gladkovskii_, May 05 2013
%F G.f.: Q(0)/(2+2*x), where Q(k)= 1 + 1/(1 - x*(2*k-1)/( x*(2*k+1) + 1/Q(k+1) )); (continued fraction). - _Sergei N. Gladkovskii_, Aug 10 2013
%F G.f.: Q(0)/2, where Q(k) = 1 + 1/(1 - x*(4*k+2 - x )/( x*(4*k+4 - x) - 1/Q(k+1) )); (continued fraction). - _Sergei N. Gladkovskii_, Sep 09 2013
%F G.f.: 1 / (1 + 2*x / (1 + x / (2 - x))). - _Michael Somos_, Jan 20 2017
%F a(n) = (-1)^n * a(-2-n) for all n in Z. - _Michael Somos_, Jan 20 2017
%F a(n) = (-(-1-sqrt(2))^(1+n) + (-1+sqrt(2))^(1+n)) / (2*sqrt(2)). - _Colin Barker_, Jan 21 2017
%F E.g.f.: exp(-x)*(2*cosh(sqrt(2)*x) - sqrt(2)*sinh(sqrt(2)*x))/2. - _Stefano Spezia_, Feb 01 2023
%e G.f. = 1 - 2*x + 5*x^2 - 12*x^3 + 29*x^4 - 70*x^5 + 169*x^6 - 408*x^7 + ...
%t PSE[a_,b_,n_]:=Join[{1,x=a,y=b},Table[z=Floor[y^2/x+1/2];x=y;y=z,{n}]];A077985=PSE[-2,5,50] (* _Vladimir Joseph Stephan Orlovsky_, Mar 26 2011 *)
%t LinearRecurrence[{-2,1},{1,-2},40] (* _Harvey P. Dale_, Jun 04 2012 *)
%t CoefficientList[Series[1/(1 + 2 x/(1 + x/(2 - x))), {x, 0, 30}], x] (* _Vincenzo Librandi_, Jan 21 2017 *)
%o (Sage) taylor( x/(1 + 2*x - x^2) ,x,0,31) # _Zerinvary Lajos_, May 29 2009
%o (PARI) Vec(1/(1+2*x-x^2)+O(x^99)) \\ _Charles R Greathouse IV_, Sep 23 2012
%o (PARI) {a(n) = if( n<-1, (-1)^n*a(-2-n), polcoeff( 1 / (1 + 2*x - x^2) + x * O(x^n), n))}; /* _Michael Somos_, Jan 20 2017 */
%o (PARI) {a(n) = - imag((-1 - quadgen(8))^(n+1))}; /* _Michael Somos_, Jan 20 2017 */
%o (Magma) I:=[1,-2]; [n le 2 select I[n] else -2*Self(n-1)+Self(n-2): n in [1..35]]; // _Vincenzo Librandi_, Jan 21 2017
%Y Essentially the same as A000129, which is the main entry for these numbers.
%Y Cf. A123335, A175181, A251733.
%K sign,easy
%O 0,2
%A _N. J. A. Sloane_, Nov 17 2002