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.

Showing 1-4 of 4 results.

A088457 Number of single nodes (exactly one node on that level) for all Motzkin paths of length n.

Original entry on oeis.org

1, 0, 1, 2, 4, 8, 18, 44, 113, 296, 782, 2076, 5538, 14856, 40100, 108936, 297793, 818832, 2263481, 6286498, 17532707, 49077268, 137821247, 388150322, 1095980561, 3101840232, 8797579789, 25001305410, 71179961918, 203000438544, 579876376729, 1658948939262
Offset: 0

Views

Author

Michael Somos, Oct 01 2003

Keywords

Comments

A Motzkin path of length n is a sequence [y(0),...,y(n)] such that |y(i)-y(i+1)| <= 1, 0=y(0)=y(n)<=y(i).

Examples

			[0,0,0,1,0], [0,0,1,0,0], [0,1,0,0,0], [0,1,2,1,0] are the a(4) = 4 sequences.
		

Crossrefs

Column k=1 of A364386 and of A372014.

Programs

  • Maple
    b:= proc(x, y, h, c) option remember; `if`(y<0 or y>x, 0,
         `if`(x=0, c, add(b(x-1, y-i, max(h, y),
         `if`(h=y, 0, `if`(h b(n, 0$2, 1):
    seq(a(n), n=0..31);  # Alois P. Heinz, Jul 25 2023
  • Mathematica
    b[x_, y_, h_, c_] := b[x, y, h, c] = If[y<0 || y>x, 0, If[x == 0, c, Sum[b[x-1, y-i, Max[h, y], If[h == y, 0, If[h < y, 1, c]]], {i, -1, 1}]]];
    a[n_] := b[n, 0, 0, 1];
    Table[a[n], {n, 0, 31}] (* Jean-François Alcover, Oct 23 2023, after Alois P. Heinz *)
  • PARI
    {a(n)=local(p0, p1, p2); if(n<0, 0, p1=1; polcoeff(sum(i=0, n, if(p2=(1-x)*p1-x^2*p0, p0=p1; p1=p2; (x^i/p0)^2), x*O(x^n)), n))}

Extensions

a(30)-a(31) from Alois P. Heinz, Jul 21 2023

A371928 T(n,k) is the total number of levels in all Dyck paths of semilength n containing exactly k path nodes; triangle T(n,k), n>=0, 1<=k<=n+1, read by rows.

Original entry on oeis.org

1, 1, 1, 1, 3, 1, 3, 5, 6, 1, 8, 15, 13, 11, 1, 23, 44, 43, 29, 20, 1, 71, 134, 138, 106, 62, 37, 1, 229, 427, 446, 371, 248, 132, 70, 1, 759, 1408, 1478, 1275, 941, 571, 283, 135, 1, 2566, 4753, 5017, 4410, 3437, 2331, 1310, 611, 264, 1, 8817, 16321, 17339, 15458, 12426, 9027, 5709, 3002, 1324, 521, 1
Offset: 0

Views

Author

Alois P. Heinz, Apr 14 2024

Keywords

Comments

A Dyck path of semilength n has 2n+1 = A005408(n) nodes.

Examples

			In the A000108(3) = 5 Dyck paths of semilength 3 there are 3 levels with 1 node, 5 levels with 2 nodes, 6 levels with 3 nodes, and 1 level with 4 nodes.
  1
  2   /\      2           1           1
  2  /  \     3  /\/\     3  /\       3    /\     3
  2 /    \    2 /    \    3 /  \/\    3 /\/  \    4 /\/\/\    .
  So row 3 is [3, 5, 6, 1].
Triangle T(n,k) begins:
     1;
     1,     1;
     1,     3,     1;
     3,     5,     6,     1;
     8,    15,    13,    11,     1;
    23,    44,    43,    29,    20,    1;
    71,   134,   138,   106,    62,   37,    1;
   229,   427,   446,   371,   248,  132,   70,    1;
   759,  1408,  1478,  1275,   941,  571,  283,  135,    1;
  2566,  4753,  5017,  4410,  3437, 2331, 1310,  611,  264,   1;
  8817, 16321, 17339, 15458, 12426, 9027, 5709, 3002, 1324, 521, 1;
  ...
		

Crossrefs

Columns k=1-2 give: A152880, A371903.
Row sums give A261003.
T(n+1,n+1) gives A006127.

Programs

  • Maple
    g:= proc(x, y, p) (h-> `if`(x=0, add(z^coeff(h, z, i)
              , i=0..degree(h)), b(x, y, h)))(p+z^y) end:
    b:= proc(x, y, p) option remember; `if`(y+2<=x,
          g(x-1, y+1, p), 0)+`if`(y>0, g(x-1, y-1, p), 0)
        end:
    T:= n-> (p-> seq(coeff(p, z, i), i=1..n+1))(g(2*n, 0$2)):
    seq(T(n), n=0..10);

Formula

Sum_{k=1..n+1} k * T(n,k) = A001700(n) = A005408(n) * A000108(n).

A152879 Triangle read by rows: T(n,k) is the number of Dyck paths of semilength n having k peaks of maximum height (1 <= k <= n).

Original entry on oeis.org

1, 1, 1, 3, 1, 1, 8, 4, 1, 1, 23, 12, 5, 1, 1, 71, 36, 17, 6, 1, 1, 229, 114, 54, 23, 7, 1, 1, 759, 377, 176, 78, 30, 8, 1, 1, 2566, 1279, 596, 263, 109, 38, 9, 1, 1, 8817, 4408, 2070, 912, 382, 148, 47, 10, 1, 1, 30717, 15375, 7289, 3240, 1358, 541, 196, 57, 11, 1, 1, 108278
Offset: 1

Views

Author

Emeric Deutsch, Jan 02 2009

Keywords

Comments

Row sums are the Catalan numbers (A000108).
T(n,1) = A152880(n).
Sum_{k=1..n} k*T(n,k) = A152880(n+1).

Examples

			T(4,2)=4 because we have UU(UD)(UD)DD, U(UD)DU(UD)D, U(UD)(UD)DUD and UDU(UD)(UD)D, where U=(1,1), D=(1,-1), with the peaks of maximum height shown between parentheses.
Triangle starts:
   1;
   1,  1;
   3,  1,  1;
   8,  4,  1,  1;
  23, 12,  5,  1,  1;
  71, 36, 17,  6,  1,  1;
  ...
		

Crossrefs

T(2n,n) gives A364030.

Programs

  • Maple
    f[0] := 1: f[1] := 1: for i from 2 to 20 do f[i] := sort(expand(f[i-1]-z*f[i-2])) end do: G := sum(t*z^j/(f[j]*(f[j]-t*z*f[j-1])), j = 1 .. 20): Gser := simplify(series(G, z = 0, 17)): for n to 12 do P[n] := sort(coeff(Gser, z, n)) end do: for n to 12 do seq(coeff(P[n], t, k), k = 1 .. n) end do; # yields sequence in triangular form

Formula

G.f. = G(t,z) = Sum_{j>=1}tz^j/(f(j)(f(j)-tzf(j-1))), where the f(j)'s are the Fibonacci polynomials (in z) defined by f(0)=f(1)=1, f(j) = f(j-1) - zf(j-2), j>=2 (Sergi Elizalde).

A371903 Total number of levels in all Dyck paths of semilength n containing exactly 2 path nodes.

Original entry on oeis.org

0, 1, 3, 5, 15, 44, 134, 427, 1408, 4753, 16321, 56812, 200046, 711425, 2551886, 9222147, 33544682, 122712465, 451169747, 1666248405, 6178586630, 22994275870, 85859249486, 321562877934, 1207665205311, 4547078084804
Offset: 0

Views

Author

Alois P. Heinz, Apr 13 2024

Keywords

Examples

			a(3) = 3 + 2 + 0 + 0 + 0 = 5:
   1
  _2   /\      _2           1           1
  _2  /  \      3  /\/\     3  /\       3    /\     3
  _2 /    \    _2 /    \    3 /  \/\    3 /\/  \    4 /\/\/\    .
		

Crossrefs

Column k=2 of A371928.

Programs

  • Maple
    g:= proc(x, y, p) (h-> `if`(x=0, add(`if`(coeff(h, z, i)=2, 1, 0),
          i=0..degree(h)), b(x, y, h)))(p+`if`(coeff(p, z, y)<3, z^y, 0))
        end:
    b:= proc(x, y, p) option remember; `if`(y+2<=x,
          g(x-1, y+1, p), 0)+`if`(y>0, g(x-1, y-1, p), 0)
        end:
    a:= n-> g(2*n, 0$2):
    seq(a(n), n=0..18);
Showing 1-4 of 4 results.