login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A108122
G.f.: (1-2*x^2)/(1-x-2*x^2-x^3).
1
1, 1, 1, 4, 7, 16, 34, 73, 157, 337, 724, 1555, 3340, 7174, 15409, 33097, 71089, 152692, 327967, 704440, 1513066, 3249913, 6980485, 14993377, 32204260, 69171499, 148573396, 319120654, 685438945, 1472253649, 3162252193, 6792198436, 14588956471, 31335605536
OFFSET
0,4
COMMENTS
The sequence counts row lengths of an array in which rows are obtained by the substitution 1->2, 2->3, 3->1,2,2,3 from previous rows:
1;
2;
3;
1,2,2,3;
2,3,3,1,2,2,3;
3,1,2,2,3,1,2,2,3,2,3,3,1,2,2,3;
FORMULA
a(n) = a(n-1) + 2*a(n-2) + a(n-3), starting 1,1,1.
a(n) = A002478(n) - 2*A002478(n-2), n>1.
a(n) = sum(m=0..n/2, sum(i=0..m, 2^i*binomial(n-2*m+1,m-i)*binomial(n-2*m+i,n-2*m))). - Vladimir Kruchinin, Dec 17 2011
MAPLE
a[0], a[1], a[2]:= 1, 1, 1:
for n from 3 to 100 do
a[n]:= a[n-1]+2*a[n-2]+a[n-3]
od:
seq(a[i], i=0..100); # Robert Israel, Jun 15 2014
MATHEMATICA
s[1] = {2}; s[2] = {3}; s[3] = {1, 2, 2, 3}; t[a_] := Flatten[s /@ a]; p[0] = {1}; p[1] = t[p[0]]; p[n_] := t[p[n - 1]] a0 = Table[Length[p[i]], {i, 0, 20}]
f[n_] := Sum[ 2^i*Binomial[n - 2 m, m - i]*Binomial[n - 2 m + i - 1, n - 2 m - 1], {m, 0, (n - 1)/2}, {i, 0, m}]; f[0] = 1; Array[f, 33, 0] (* or *)
CoefficientList[ Series[(1 - 2 x^2)/(1 - x - 2 x^2 - x^3), {x, 0, 33}], x] (* or *)
LinearRecurrence[ {1, 2, 1}, {1, 1, 1}, 34] (* or *)
Length /@ NestList[ Flatten[ # /. {1 -> 2, 2 -> 3, 3 -> {1, 2, 2, 3}}] &, {1}, 24] (* Robert G. Wilson v, Jun 13 2014 *)
PROG
(Maxima)
a(n):=sum(sum(2^i*binomial(n-2*m+1, m-i)*binomial(n-2*m+i, n-2*m), i, 0, m), m, 0, (n)/2); /* Vladimir Kruchinin, Dec 17 2011 */
CROSSREFS
Sequence in context: A051049 A298415 A373653 * A192800 A027609 A145763
KEYWORD
nonn,easy
AUTHOR
Roger L. Bagula, Jun 04 2005
EXTENSIONS
More terms from Wesley Ivan Hurt, Jun 14 2014
STATUS
approved