OFFSET
1,3
COMMENTS
A140165 is a companion sequence.
LINKS
Joerg Arndt, Table of n, a(n) for n = 1..200
Index entries for linear recurrences with constant coefficients, signature (-1,3). [R. J. Mathar, Dec 12 2009]
FORMULA
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].
From R. J. Mathar, Dec 12 2009: (Start)
a(n) = (-1)^n*A006130(n-1).
G.f.: -x/(1+x-3*x^2). (End)
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
E.g.f.: (1/sqrt(13))*(exp(-(1+sqrt(13))*x/2) - exp(-(1-sqrt(13))*x/2)). G. C. Greubel, Aug 30 2015
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
EXAMPLE
a(5) = -19 = (-1)*7 + 3*(-4).
a(5) = -19 = term (1,2) of X^5 since X^5 = [ -2, -19; -19, -59].
MAPLE
seq(coeff(series(-x/(1+x-3*x^2), x, n+1), x, n), n = 1..30); # G. C. Greubel, Dec 26 2019
MATHEMATICA
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 *)
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 *)
PROG
(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
(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
(Sage)
def A140167_list(prec):
P.<x> = PowerSeriesRing(ZZ, prec)
return P( -x/(1+x-3*x^2) ).list()
a=A140167_list(30); a[1:] # G. C. Greubel, Dec 26 2019
(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
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Gary W. Adamson, May 10 2008
STATUS
approved