A052939 Expansion of (1-x)*(1+x)/(1-3*x-x^2+2*x^3).
1, 3, 9, 28, 87, 271, 844, 2629, 8189, 25508, 79455, 247495, 770924, 2401357, 7480005, 23299524, 72575863, 226067103, 704178124, 2193449749, 6832393165, 21282272996, 66292312655, 206494424631, 643211040556, 2003542920989
Offset: 0
Links
- Harvey P. Dale, Table of n, a(n) for n = 0..1000
- INRIA Algorithms Project, Encyclopedia of Combinatorial Structures 930
- Index entries for linear recurrences with constant coefficients, signature (3,1,-2).
Programs
-
GAP
a:=[1,3,9];; for n in [4..30] do a[n]:=3*a[n-1]+a[n-2]-2*a[n-3]; od; a; # G. C. Greubel, Oct 18 2019
-
Magma
R
:=PowerSeriesRing(Integers(), 30); Coefficients(R!( (1-x^2)/(1-3*x-x^2+2*x^3) )); // G. C. Greubel, Oct 18 2019 -
Maple
spec := [S,{S=Sequence(Union(Z,Z,Prod(Z,Sequence(Prod(Z,Z)))))},unlabeled ]: seq(combstruct[count ](spec,size=n), n=0..20); seq(coeff(series((1-x^2)/(1-3*x-x^2+2*x^3), x, n+1), x, n), n = 0..30); # G. C. Greubel, Oct 18 2019
-
Mathematica
LinearRecurrence[{3,1,-2},{1,3,9},30] (* Harvey P. Dale, Aug 25 2019 *)
-
PARI
my(x='x+O('x^30)); Vec((1-x^2)/(1-3*x-x^2+2*x^3)) \\ G. C. Greubel, Oct 18 2019
-
Sage
def A052939_list(prec): P.
= PowerSeriesRing(ZZ, prec) return P((1-x^2)/(1-3*x-x^2+2*x^3)).list() A052939_list(30) # G. C. Greubel, Oct 18 2019
Formula
G.f.: (1-x^2)/(1-3*x-x^2+2*x^3).
a(n) = 3*a(n-1) + a(n-2) - 2*a(n-3).
a(n) = Sum_{alpha=RootOf(1-3*z-z^2+2*z^3)} (1/229)*(66 +15*alpha -28*alpha^2)*alpha^(-1-n).
Extensions
More terms from James Sellers, Jun 06 2000