cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A108122 G.f.: (1-2*x^2)/(1-x-2*x^2-x^3).

Original entry on oeis.org

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

Views

Author

Roger L. Bagula, Jun 04 2005

Keywords

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;

Crossrefs

Programs

  • 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 *)
  • 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 */

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

Extensions

More terms from Wesley Ivan Hurt, Jun 14 2014