OFFSET
0,2
COMMENTS
In general a(n) = Sum_{k=0..floor(n/4)} C(n-k,3*k) * u^k * v^(n-4*k) has g.f. (1-v*x)^2/((1-v*x)^3 - u*x^4) and satisfies the recurrence a(n) = 3*v*a(n-1) - 3*v^2*a(n-2) + v^3*a(n-3) + u*a(n-4).
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (9,-27,27,1).
FORMULA
G.f.: (1-3*x)^2/((1-3*x)^3 - x^4).
a(n) = 9*a(n-1) - 27*a(n-2) + 27*a(n-3) + a(n-4).
MAPLE
seq(coeff(series((1-3*x)^2/((1-3*x)^3 - x^4), x, n+1), x, n), n = 0..30); # G. C. Greubel, Sep 04 2019
MATHEMATICA
LinearRecurrence[{9, -27, 27, 1}, {1, 3, 9, 27}, 40] (* or *) CoefficientList[ Series[-((1-3 x)^2/(x (x (x (x+27)-27)+9)-1)), {x, 0, 40}], x] (* Harvey P. Dale, Jun 06 2011 *)
PROG
(PARI) my(x='x+O('x^30)); Vec((1-3*x)^2/((1-3*x)^3 - x^4)) \\ G. C. Greubel, Sep 04 2019
(Magma) I:=[1, 3, 9, 27]; [n le 4 select I[n] else 9*Self(n-1) - 27*Self(n-2) + 27*Self(n-3) +Self(n-4): n in [1..30]]; // G. C. Greubel, Sep 04 2019
(Sage)
def A099786_list(prec):
P.<x> = PowerSeriesRing(ZZ, prec)
return P((1-3*x)^2/((1-3*x)^3 - x^4)).list()
A099786_list(30) # G. C. Greubel, Sep 04 2019
(GAP) a:=[1, 3, 9, 27];; for n in [5..30] do a[n]:=9*a[n-1]-27*a[n-2] + 27*a[n-3] +a[n-4]; od; a; # G. C. Greubel, Sep 04 2019
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Paul Barry, Oct 26 2004
STATUS
approved