OFFSET
0,2
COMMENTS
a(n) is the number of ternary strings of length n that contain at most three 0's.- Enrique Navarrete, Mar 13 2024
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (8,-24,32,-16).
FORMULA
O.g.f.: (1-x)*(1-4*x+5*x^2) / (1-2*x)^4. - R. J. Mathar, Jun 08 2008
From Colin Barker, Feb 13 2017: (Start)
a(n) = 8*a(n-1) - 24*a(n-2) + 32*a(n-3) - 16*a(n-4) for n>3.
a(n) = (2^(n-4)*(48 + 20*n + 3*n^2 + n^3)) / 3. (End)
E.g.f.: e^(2*x)*(1+x+x^2/2+x^3/6). - Enrique Navarrete, Mar 13 2024
EXAMPLE
MATHEMATICA
CoefficientList[Series[(1-x)(1-4x+5x^2)/(1-2x)^4, {x, 0, 30}], x] (* or *) LinearRecurrence[ {8, -24, 32, -16}, {1, 3, 9, 27}, 30] (* Harvey P. Dale, Mar 09 2023 *)
PROG
(PARI) Vec((1-x)*(1-4*x+5*x^2) / (1-2*x)^4 + O(x^30)) \\ Colin Barker, Feb 13 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Gary W. Adamson, Oct 23 2007
EXTENSIONS
More terms from R. J. Mathar, Jun 08 2008
STATUS
approved