OFFSET
0,3
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (0,1,2,2,1).
FORMULA
a(n) = a(n-2) + 2*a(n-3) + 2*a(n-4) + a(n-5).
G.f.: (1 + x + x^2)/(1 - x^2 - 2*x^3 - 2*x^4 - x^5). - Chai Wah Wu, May 28 2016
EXAMPLE
a(4) = 6 as 3 + 1, 1 + 3, 2 + 2, 1 + 1 + 2, 1 + 2 + 1 and 2 + 1 + 1 (but not 1 + 1 + 1 + 1).
MAPLE
a[0]:=1; a[1]:=1; a[2]:=2; a[3]:=3; a[4]:=6; for n from 5 to 45 do a[n] := a[n-2] +2*a[n-3] +2*a[n-4] +a[n-5] end do; seq(a[n], n = 0 .. 40); # modified by G. C. Greubel, Aug 06 2019
seq(coeff(series((1+x+x^2)/(1-x^2-2*x^3-2*x^4-x^5), x, n+1), x, n), n = 0 .. 40); # G. C. Greubel, Aug 06 2019
MATHEMATICA
LinearRecurrence[{0, 1, 2, 2, 1}, {1, 1, 2, 3, 6}, 40] (* G. C. Greubel, Aug 06 2019 *)
PROG
(PARI) my(x='x+O('x^40)); Vec((1+x+x^2)/(1-x^2-2*x^3-2*x^4-x^5)) \\ G. C. Greubel, Aug 06 2019
(Magma) R<x>:=PowerSeriesRing(Integers(), 40); Coefficients(R!( (1+x+x^2)/(1-x^2-2*x^3-2*x^4-x^5) )); // G. C. Greubel, Aug 06 2019
(Sage) ((1+x+x^2)/(1-x^2-2*x^3-2*x^4-x^5)).series(x, 40).coefficients(x, sparse=False) # G. C. Greubel, Aug 06 2019
(GAP) a:=[1, 1, 2, 3, 6];; for n in [6..40] do a[n]:=a[n-2]+2*a[n-3]+ 2*a[n-4]+a[n-5]; od; a; # G. C. Greubel, Aug 06 2019
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Joel B. Lewis, Oct 28 2006
STATUS
approved