%I #23 Sep 08 2022 08:45:16
%S 1,2,5,10,22,47,101,217,466,1001,2150,4618,9919,21305,45761,98290,
%T 211117,453458,973982,2092015,4493437,9651449,20730338,44526673,
%U 95638798,205422482,441226751,947710513,2035586497,4372234274
%N a(0) = 1, a(1) = 2, a(2) = 5; for n >= 3, a(n) = a(n-1) + 2*a(n-2) + a(n-3).
%C Lengths of successive words (starting with a) under the substitution: {a -> ab, b -> aac, c -> a}.
%H G. C. Greubel, <a href="/A101399/b101399.txt">Table of n, a(n) for n = 0..1000</a>
%H Dun Qiu, <a href="https://arxiv.org/abs/1810.10099">Classical pattern distributions in Sn(132) and Sn(123)</a>, arXiv:1810.10099 [math.CO], 2018. See p. 11.
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (1, 2, 1).
%F G.f.: (1+x+x^2)/(1-x-2*x^2-x^3). - _G. C. Greubel_, Apr 03 2018
%t 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 *)
%t LinearRecurrence[{1,2,1},{1,2,5},30] (* _Harvey P. Dale_, Aug 29 2012 *)
%t CoefficientList[Series[(1+x+x^2)/(1-x-2*x^2-x^3), {x, 0, 50}], x] (* _G. C. Greubel_, Apr 03 2018 *)
%o (PARI) x='x+O('x^30); Vec((1+x+x^2)/(1-x-2*x^2-x^3)) \\ _G. C. Greubel_, Apr 03 2018
%o (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
%o (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
%Y Pairwise sums of A078007. Bisection of A003410 and A058278.
%K nonn,easy
%O 0,2
%A _Jeroen F.J. Laros_, Jan 15 2005
%E More terms from _Robert G. Wilson v_ and _Lior Manor_, Jan 15 2005