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.

A247286 Triangle read by rows: T(n,k) is the number of Motzkin paths of length n having k weak peaks.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 1, 1, 4, 3, 1, 1, 8, 7, 4, 1, 1, 16, 17, 11, 5, 1, 1, 32, 41, 30, 16, 6, 1, 1, 64, 98, 82, 48, 22, 7, 1, 1, 128, 232, 220, 144, 72, 29, 8, 1, 1, 256, 544, 581, 423, 233, 103, 37, 9, 1, 1, 512, 1264, 1512, 1216, 738, 356, 142, 46, 10, 1
Offset: 0

Views

Author

Emeric Deutsch, Sep 14 2014

Keywords

Comments

A weak peak of a Motzkin path is a vertex on the top of a hump. A hump is an upstep followed by 0 or more flatsteps followed by a downstep. For example, the Motzkin path u*duu*h*h*dd, where u=(1,1), h=(1,0), d(1,-1), has 4 weak peaks (shown by the stars).
Row n (n>=1) contains n entries.
Sum of entries in row n is the Motzkin number A001006(n).
Sum(k*T(n,k), 0<=k<=n) = A247287(n).

Examples

			Row 3 is 1,2,1 because the Motzkin paths hhh, hu*d, u*dh, and u*h*d have 0, 1, 1, and 2 weak peaks (shown by the stars).
Triangle starts:
1;
1;
1,1;
1,2,1;
1,4,3,1;
1,8,7,4,1;
		

Crossrefs

Programs

  • Maple
    eq := G = 1+z*G+z^2*(G-1/(1-z)+t/(1-t*z))*G: G := RootOf(eq, G): Gser := simplify(series(G, z = 0, 16)): for n from 0 to 14 do P[n] := sort(expand(coeff(Gser, z, n))) end do: 1; for n to 14 do seq(coeff(P[n], t, k), k = 0 .. n-1) end do; # yields sequence in triangular form
    # second Maple program:
    b:= proc(x, y, t, c) option remember; `if`(y<0 or y>x, 0,
          `if`(x=0, 1, expand(b(x-1, y-1, false, 0)*z^c+b(x-1, y, t,
          `if`(t, c+1, 0))+ b(x-1, y+1, true, 1))))
        end:
    T:= n-> (p-> seq(coeff(p, z, i), i=0..degree(p)))(b(n, 0, false, 0)):
    seq(T(n), n=0..14);  # Alois P. Heinz, Sep 14 2014
  • Mathematica
    b[x_, y_, t_, c_] := b[x, y, t, c] = If[y<0 || y>x, 0, If[x == 0, 1, Expand[b[x-1, y-1, False, 0]*z^c + b[x-1, y, t, If[t, c+1, 0]] + b[x-1, y+1, True, 1]]]]; T[n_] := Function[{p}, Table[Coefficient[p, z, i], {i, 0, Exponent[p, z]}]][b[n, 0, False, 0]]; Table[T[n], {n, 0, 14}] // Flatten (* Jean-François Alcover, May 27 2015, after Alois P. Heinz *)

Formula

The g.f. G(t,z) satisfies G = 1 + z*G + z^2*(G - 1/(1-z) + t/(1-t*z))*G.

A385641 Partial sums of A097893.

Original entry on oeis.org

1, 3, 8, 20, 51, 133, 356, 972, 2695, 7557, 21372, 60840, 174097, 500295, 1442720, 4172752, 12099411, 35161001, 102375400, 298586652, 872177273, 2551118623, 7471195500, 21904500500, 64286141881, 188844619563, 555216323396, 1633658183432, 4810340397375, 14173698242137
Offset: 0

Views

Author

Mélika Tebni, Aug 03 2025

Keywords

Comments

Second partial sums of the central trinomial coefficients (A002426).
Third partial sums of A025178 (sequence starting 1, 0, 2, 4, 12, 32, 90 .... with offset 0).
For p prime of the form 4*k + 3 (A002145), a(p) + 1 == 0 (mod p).
For p Pythagorean prime (A002144), a(p) - 3 == 0 (mod p).
Sequences with g.f. (1-x)^k / sqrt(1-2*x-3*x^2): this sequence (k=-2), A097893 (k=-1), A002426 (k=0), A025178 (k=1), A024997 (k=2), A026083 (k=3). - Mélika Tebni, Aug 25 2025

Crossrefs

Programs

  • Maple
    a := series(exp(x)*(BesselI(0, 2*x) + 2*int(BesselI(0, 2*x), x) + int(int(BesselI(0, 2*x), x), x)), x = 0, 30): seq(n!*coeff(a, x, n), n = 0 .. 29);
  • PARI
    a(n) = sum(k=0, n, sum(i=0, k, sum(j=0, i, binomial(i, i-j)*binomial(j, i-j)))); \\ Michel Marcus, Aug 06 2025
  • Python
    from math import comb as C
    def a(n):
        return sum(C(n+1, k+1)*C(2*(k//2), k//2) for k in range(n + 1))
    print([a(n) for n in range(30)])
    

Formula

G.f.: (1 / sqrt((1 + x)*(1 - 3*x))) / (1 - x)^2.
E.g.f.: exp(x)*(BesselI(0, 2*x) + 2*g(x) + Integral_{x=-oo..oo} g(x) dx) where g(x) = Integral_{x=-oo..oo} BesselI(0, 2*x) dx.
D-finite with recurrence n*a(n) = (4*n-1)*a(n-1) - (2*n+1)*a(n-2) - (4*n-5)*a(n-3) + 3*(n-1)*a(n-4).
a(0) = 1, a(1) = 3 and a(n) = a(n-2) - 1 + 2*A383527(n) for n >= 2.
a(n) = Sum_{k=0..n} binomial(n+1, k+1)*A128014(k).
a(n) = Sum_{k=0..n} (2*A247287(k) + k+1).
a(n) ~ 3^(n + 5/2) / (8*sqrt(Pi*n)). - Vaclav Kotesovec, Aug 03 2025
Sum_{k=0..n} A295112(n-k)*a(k) + binomial(n+3, 3) = 0. - Mélika Tebni, Sep 03 2025
Showing 1-2 of 2 results.