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-2 of 2 results.

A097874 Duplicate of A097885.

Original entry on oeis.org

1, 1, 2, 4, 8, 1, 17, 4, 37, 13, 1, 82, 40, 5, 185, 116, 21, 1, 423, 326, 80, 6, 978, 899, 279
Offset: 0

Views

Author

Keywords

A097860 Triangle read by rows: T(n,k) is the number of Motzkin paths of length n with k peaks (n>=0, 0<=k<=floor(n/2)).

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 4, 4, 1, 8, 10, 3, 17, 24, 9, 1, 37, 58, 28, 4, 82, 143, 81, 16, 1, 185, 354, 231, 60, 5, 423, 881, 653, 205, 25, 1, 978, 2204, 1824, 676, 110, 6, 2283, 5534, 5058, 2164, 435, 36, 1, 5373, 13940, 13946, 6756, 1631, 182, 7, 12735, 35213, 38262, 20710
Offset: 0

Views

Author

Emeric Deutsch, Sep 01 2004

Keywords

Comments

Row sums are the Motzkin numbers (A001006). Column 0 gives A004148.
This triangle is the Motzkin path equivalent to the Narayana numbers (A001263). - Dan Drake, Feb 17 2011

Examples

			Triangle starts:
   1;
   1;
   1,  1;
   2,  2;
   4,  4, 1;
   8, 10, 3;
  17, 24, 9, 1;
  ...
Row n has 1+floor(n/2) terms.
T(4,1)=4 because (UD)HH, H(UD)H, HH(UD) and U(UD)D are the only Motzkin paths of length 4 with 1 peak (here U=(1,1), H=(1,0) and D=(1,-1)); peaks are shown between parentheses.
		

Crossrefs

Programs

  • Maple
    eq:=G=1+z*G+z^2*G*(G-1+t):sol:=solve(eq,G): G:=sol[2]: Gser:=simplify(series(G,z=0,16)): P[0]:=1: for n from 1 to 13 do P[n]:=sort(coeff(Gser,z^n)) od: seq(seq(coeff(t*P[n],t^k),k=1..1+floor(n/2)),n=0..13);
    # Alternatively
    A097860_row := proc(n) local w,f,p,i;
    w := 1-x+x^2-x^2*t; f := (w-sqrt(w^2-4*x^2))/(2*x^2);
    p := simplify(coeff(series(f,x,3+2*n),x,n));
    seq(coeff(p,t,i), i=0..iquo(n,2)) end:
    seq(print(A097860_row(n)), n=0..7); # Peter Luschny, Nov 14 2014
    # third Maple program:
    b:= proc(x, y, t) option remember; expand(`if`(y<0 or y>x, 0,
         `if`(x=0, 1, b(x-1, y, 1)+b(x-1, y-1, 1)*t+b(x-1, y+1, z))))
        end:
    T:= n-> (p-> seq(coeff(p, z, i), i=0..degree(p)))(b(n, 0, 1)):
    seq(T(n), n=0..15);  # Alois P. Heinz, Feb 01 2019
  • Mathematica
    gf = With[{w = 1 - x + x^2 - x^2*t}, (w - Sqrt[w^2 - 4*x^2])/(2*x^2)];
    cx[n_] := cx[n] = SeriesCoefficient[gf, {x, 0, n}];
    T[n_, k_] := SeriesCoefficient[cx[n], {t, 0, k}];
    Table[T[n, k], {n, 0, 14}, {k, 0, n/2}] // Flatten (* Jean-François Alcover, Dec 04 2017, after Peter Luschny *)

Formula

G.f. G = G(t, z) satisfies G = 1+z*G+z^2*G*(G-1+t).
G.f. has explicit form G(x,t) = (w-sqrt(w^2-4*x^2))/(2*x^2) with w = 1-x+x^2-x^2*t. (Drake and Ganter, Th. 6) - Peter Luschny, Nov 14 2014
Showing 1-2 of 2 results.