This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A141576 #29 Sep 18 2024 10:37:14 %S A141576 -1,0,1,0,-2,-1,3,3,-4,-7,4,14,-1,-25,-9,40,33,-56,-82,63,171,-37, %T A141576 -316,-71,524,350,-769,-945,943,2064,-767,-3952,-354,6783,3539,-10381, %U A141576 -10676,13625,24596,-13330,-48897,2359,86823,33208,-138079,-117672,191694 %N A141576 a(0)=-1, a(1)=0, a(2)=1, a(n) = a(n-1) - 2*a(n-2) + a(n-3). %D A141576 Martin Gardner, Mathematical Circus, Random House, New York, 1981, p. 165. %H A141576 Michael De Vlieger, <a href="/A141576/b141576.txt">Table of n, a(n) for n = 0..1000</a> %H A141576 <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (1,-2,1). %F A141576 From _R. J. Mathar_, Aug 25 2008: (Start) %F A141576 O.g.f.: -(1-x+x^2)/(1-x+2*x^2-x^3). %F A141576 a(n) = A078019(n-2), n > 0. (End) %F A141576 a(n) = -A000931(-2*n + 3). - _Michael Somos_, Sep 18 2012 %e A141576 G.f. = -1 + x^2 - 2*x^4 - x^5 + 3*x^6 + 3*x^7 - 4*x^8 - 7*x^9 + ... %t A141576 Nest[Append[#, #[[-1]] - 2 #[[-2]] + #[[-3]]] &, {-1, 0, 1}, 44] (* _Michael De Vlieger_, Dec 17 2017 *) %t A141576 LinearRecurrence[{1,-2,1},{-1,0,1},50] (* _Harvey P. Dale_, Feb 06 2024 *) %o A141576 (MATLAB) %o A141576 function y=fib(n) %o A141576 %Generates difference sequence %o A141576 fz(1)=-1; fz(2)=0; fz(3)=1; %o A141576 for k=4:n %o A141576 fz(k)=fz(k-1)-2*fz(k-2)+fz(k-3); %o A141576 end %o A141576 y=fz(n); %o A141576 (PARI) x='x+O('x^99); Vec((1-x+x^2)/(-1+x-2*x^2+x^3)) \\ _Altug Alkan_, Dec 17 2017 %o A141576 (Magma) %o A141576 I:=[-1,0,1]; [n le 3 select I[n] else Self(n-1) -2*Self(n-2) +Self(n-3): n in [1..50]]; // _G. C. Greubel_, Sep 16 2024 %o A141576 (SageMath) %o A141576 def A141576_list(prec): %o A141576 P.<x> = PowerSeriesRing(ZZ, prec) %o A141576 return P( -(1-x+x^2)/(1-x+2*x^2-x^3) ).list() %o A141576 A141576_list(50) # _G. C. Greubel_, Sep 16 2024 %Y A141576 Cf. A000931, A078019, A141577. %K A141576 sign,easy %O A141576 0,5 %A A141576 Matt Wynne (mattwyn(AT)verizon.net), Aug 18 2008 %E A141576 Extended by _R. J. Mathar_, Aug 25 2008