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 A140167 #50 Sep 29 2024 16:40:07 %S A140167 -1,1,-4,7,-19,40,-97,217,-508,1159,-2683,6160,-14209,32689,-75316, %T A140167 173383,-399331,919480,-2117473,4875913,-11228332,25856071,-59541067, %U A140167 137109280,-315732481,727060321,-1674257764,3855438727,-8878212019,20444528200 %N A140167 a(n) = (-1)*a(n-1) + 3*a(n-2) with a(1)=-1 and a(2)=1. %C A140167 A140165 is a companion sequence. %H A140167 Joerg Arndt, <a href="/A140167/b140167.txt">Table of n, a(n) for n = 1..200</a> %H A140167 <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (-1,3). [_R. J. Mathar_, Dec 12 2009] %F A140167 a(n) = (-1)*a(n-1) + 3*a(n-2), given a(1) = -1, a(2) = 1. a(n) = term (1,2) of X^n, where X = the 2x2 matrix [1,-1; -1,-2]. %F A140167 From _R. J. Mathar_, Dec 12 2009: (Start) %F A140167 a(n) = (-1)^n*A006130(n-1). %F A140167 G.f.: -x/(1+x-3*x^2). (End) %F A140167 G.f.: -Q(0)/2 , where Q(k) = 1 + 1/(1 - x*(4*k-1 + 3*x)/( x*(4*k+1 + 3*x) + 1/Q(k+1) )); (continued fraction). - _Sergei N. Gladkovskii_, Sep 08 2013 %F A140167 E.g.f.: (1/sqrt(13))*(exp(-(1+sqrt(13))*x/2) - exp(-(1-sqrt(13))*x/2)). _G. C. Greubel_, Aug 30 2015 %F A140167 a(n) = -(-sqrt(3))^(n-1)*(Lucas(n-1, 1/sqrt(3)) + Fibonacci(n-1, 1/sqrt(3) )/sqrt(3))/2. - _G. C. Greubel_, Dec 26 2019 %e A140167 a(5) = -19 = (-1)*7 + 3*(-4). %e A140167 a(5) = -19 = term (1,2) of X^5 since X^5 = [ -2, -19; -19, -59]. %p A140167 seq(coeff(series(-x/(1+x-3*x^2), x, n+1), x, n), n = 1..30); # _G. C. Greubel_, Dec 26 2019 %t A140167 RecurrenceTable[{a[n]== -a[n-1]+3*a[n-2], a[1]== -1, a[2]==1}, a, {n,30}] (* _G. C. Greubel_, Aug 30 2015 *) %t A140167 Table[Round[-(-Sqrt[3])^(n-1)*(LucasL[n-1, 1/Sqrt[3]] + Fibonacci[n-1, 1/Sqrt[3] ]/Sqrt[3])/2], {n,30}] (* _G. C. Greubel_, Dec 26 2019 *) %o A140167 (PARI) first(m)=my(v=vector(m));v[1]=-1;v[2]=1;for(i=3,m,v[i]=-v[i-1] + 3*v[i-2]); v \\ _Anders Hellström_, Aug 30 2015 %o A140167 (Magma) I:=[-1,1]; [n le 2 select I[n] else (-1)*Self(n-1) + 3*Self(n-2): n in [1..30]]; // _Vincenzo Librandi_, Aug 31 2015 %o A140167 (Sage) %o A140167 def A140167_list(prec): %o A140167 P.<x> = PowerSeriesRing(ZZ, prec) %o A140167 return P( -x/(1+x-3*x^2) ).list() %o A140167 a=A140167_list(30); a[1:] # _G. C. Greubel_, Dec 26 2019 %o A140167 (GAP) a:=[-1,1];; for n in [3..30] do a[n]:= -a[n-1]+3*a[n-2]; od; a; # _G. C. Greubel_, Dec 26 2019 %Y A140167 Cf. A140165, A182228. %K A140167 sign,easy %O A140167 1,3 %A A140167 _Gary W. Adamson_, May 10 2008