OFFSET
0,2
COMMENTS
In general a(n) = Sum_{k=0..floor(n/3)} C(n-k,2*k) * u^k*v^(n-3*k) has g.f. (1-v*x) / ((1-v*x)^2-u*x^2) and satisfies the recurrence a(n) = 2*u*v*a(n-1) - v^2*a(n-2) + u*a(n-3).
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (6,-9,2).
FORMULA
G.f.: (1-3*x)/((1-3*x)^2 - 2*x^3).
a(n) = 6*a(n-1) - 9*a(n-2) + 2*a(n-3).
a(n) = A001834(n)/3 + 2^(n+1)/3. - R. J. Mathar, Sep 21 2012
a(n) = (2^(2+n) - (2-sqrt(3))^n*(-1+sqrt(3)) + (1+sqrt(3))*(2+sqrt(3))^n) / 6. - Colin Barker, Feb 05 2017
E.g.f.: (1/3)*exp(2*x)*(2 + cosh(sqrt(3)*x) + sqrt(3)*sinh(sqrt(3)*x)). - Stefano Spezia, Sep 04 2019
MAPLE
seq(coeff(series((1-3*x)/((1-3*x)^2 -2*x^3), x, n+1), x, n), n = 0..30); # G. C. Greubel, Sep 04 2019
MATHEMATICA
LinearRecurrence[{6, -9, 2}, {1, 3, 9}, 30] (* Harvey P. Dale, Nov 30 2015 *)
PROG
(PARI) Vec((1-3*x) / ((1-3*x)^2-2*x^3) + O(x^30)) \\ Colin Barker, Feb 05 2017
(PARI) a(n) = sum(k=0, n\3, binomial(n-k, 2*k) * 2^k*3^(n-3*k)); \\ Michel Marcus, Feb 05 2017
(Magma) I:=[1, 3, 9]; [n le 3 select I[n] else 6*Self(n-1) - 9*Self(n-2) + 2*Self(n-3): n in [1..30]]; // G. C. Greubel, Sep 04 2019
(Sage)
def A099780_list(prec):
P.<x> = PowerSeriesRing(ZZ, prec)
return P((1-3*x)/((1-3*x)^2 -2*x^3)).list()
A099780_list(30) # G. C. Greubel, Sep 04 2019
(GAP) a:=[1, 3, 9];; for n in [4..30] do a[n]:=6*a[n-1]-9*a[n-2]+2*a[n-3]; od; a; # G. C. Greubel, Sep 04 2019
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Paul Barry, Oct 26 2004
STATUS
approved