OFFSET
0,2
COMMENTS
Lengths of successive words (starting with a) under the substitution: {a -> ab, b -> aac, c -> a}.
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Dun Qiu, Classical pattern distributions in Sn(132) and Sn(123), arXiv:1810.10099 [math.CO], 2018. See p. 11.
Index entries for linear recurrences with constant coefficients, signature (1, 2, 1).
FORMULA
G.f.: (1+x+x^2)/(1-x-2*x^2-x^3). - G. C. Greubel, Apr 03 2018
MATHEMATICA
a[0] = 1; a[1] = 2; a[2] = 5; a[n_] := a[n] = a[n - 1] + 2a[n - 2] + a[n - 3]; Table[ a[n], {n, 0, 30}] (* Robert G. Wilson v, Jan 15 2005 *)
LinearRecurrence[{1, 2, 1}, {1, 2, 5}, 30] (* Harvey P. Dale, Aug 29 2012 *)
CoefficientList[Series[(1+x+x^2)/(1-x-2*x^2-x^3), {x, 0, 50}], x] (* G. C. Greubel, Apr 03 2018 *)
PROG
(PARI) x='x+O('x^30); Vec((1+x+x^2)/(1-x-2*x^2-x^3)) \\ G. C. Greubel, Apr 03 2018
(Magma) I:=[1, 2, 5]; [n le 3 select I[n] else Self(n-1) + 2*Self(n-2) + Self(n-3): n in [1..30]]; /* or */ m:=25; R<x>:=PowerSeriesRing( Integers(), m); Coefficients(R!((1+x+x^2)/(1-x-2*x^2-x^3))); // G. C. Greubel, Apr 03 2018
(GAP) a:=[1, 2, 5];; for n in [4..35] do a[n]:=a[n-1]+2*a[n-2]+a[n-3]; od; a; # Muniru A Asiru, Apr 03 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jeroen F.J. Laros, Jan 15 2005
EXTENSIONS
More terms from Robert G. Wilson v and Lior Manor, Jan 15 2005
STATUS
approved