OFFSET
0,1
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
INRIA Algorithms Project, Encyclopedia of Combinatorial Structures 923
Index entries for linear recurrences with constant coefficients, signature (2,0,1,-2).
FORMULA
G.f.: (2-2*x-x^3)/((1-x^3)*(1-2*x)).
a(n) = a(n-1) + a(n-2) + 2*a(n-3) - 1.
a(n) = 2^n + Sum_{alpha=RootOf(-1+z^3)} alpha^(-n)/3.
MAPLE
spec:= [S, {S=Union(Sequence(Prod(Z, Z, Z)), Sequence(Union(Z, Z)))}, unlabeled ]: seq(combstruct[count ](spec, size=n), n=0..20);
seq(coeff(series((2-2*x-x^3)/((1-2*x)*(1-x^3)), x, n+1), x, n), n = 0 .. 40); # G. C. Greubel, Oct 18 2019
MATHEMATICA
CoefficientList[Series[(2-2*x-x^3)/((1-2*x)*(1-x^3)), {x, 0, 40}], x] (* G. C. Greubel, Oct 05 2017 *)
LinearRecurrence[{2, 0, 1, -2}, {2, 2, 4, 9}, 40] (* G. C. Greubel, Oct 18 2019 *)
PROG
(PARI) my(x='x+O('x^40)); Vec((2-2*x-x^3)/((1-2*x)*(1-x^3))) \\ G. C. Greubel, Oct 05 2017
(Magma) R<x>:=PowerSeriesRing(Integers(), 40); Coefficients(R!( (2-2*x-x^3)/((1-2*x)*(1-x^3)) )); // G. C. Greubel, Oct 18 2019
(Sage)
def A052935_list(prec):
P.<x> = PowerSeriesRing(ZZ, prec)
return P((2-2*x-x^3)/((1-2*x)*(1-x^3))).list()
A052935_list(40) # G. C. Greubel, Oct 18 2019
(GAP) a:=[2, 2, 4, 9];; for n in [5..40] do a[n]:=2*a[n-1]+a[n-3]-2*a[n-4]; od; a; # G. C. Greubel, Oct 18 2019
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
encyclopedia(AT)pommard.inria.fr, Jan 25 2000
EXTENSIONS
More terms from James A. Sellers, Jun 05 2000
STATUS
approved