|
|
A101400
|
|
a(n) = a(n-1) + 2*a(n-2) + a(n-3) - a(n-4).
|
|
5
|
|
|
1, 2, 5, 10, 21, 44, 91, 190, 395, 822, 1711, 3560, 7409, 15418, 32085, 66770, 138949, 289156, 601739, 1252230, 2605915, 5422958, 11285279, 23484880, 48872481, 101704562, 211649125, 440445850, 916576181, 1907412444, 3969361531
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
COMMENTS
|
Lengths of successive words (starting with a) under the substitution: {a -> ab, b -> aac, c -> d, d -> b}.
|
|
LINKS
|
|
|
FORMULA
|
G.f.: (1+x+x^2)/(1-x-2*x^2-x^3+x^4). - G. C. Greubel, Apr 03 2018
|
|
EXAMPLE
|
a(0) = 1, a(1) = 2, a(2) = 5, a(3) = 10, a(4) = 21, a(5) = 44
|
|
MATHEMATICA
|
a[0] = 1; a[1] = 2; a[2] = 5; a[3] = 10; a[n_] := a[n] = a[n - 1] + 2a[n - 2] + a[n - 3] - a[n - 4]; Table[ a[n], {n, 0, 30}] (* Robert G. Wilson v, Jan 15 2005 *)
LinearRecurrence[{1, 2, 1, -1}, {1, 2, 5, 10}, 40] (* Harvey P. Dale, Oct 24 2017 *)
|
|
PROG
|
(PARI) x='x+O('x^30); Vec((1+x+x^2)/(1-x-2*x^2-x^3+x^4)) \\ G. C. Greubel, Apr 03 2018
(Magma) I:=[1, 2, 5, 10]; [n le 4 select I[n] else Self(n-1) + 2*Self(n-2) + Self(n-3) - Self(n-4): 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+x^4))); // G. C. Greubel, Apr 03 2018
(GAP) a:=[1, 2, 5, 10];; for n in [5..35] do a[n]:=a[n-1]+2*a[n-2]+a[n-3]-a[n-4]; od; a; # Muniru A Asiru, Apr 03 2018
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|