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

A194588 a(n) = A189912(n-1)-a(n-1) for n>0, a(0) = 1; extended Riordan numbers.

Original entry on oeis.org

1, 0, 2, 2, 8, 17, 49, 128, 356, 983, 2759, 7779, 22087, 63000, 180478, 518846, 1496236, 4326383, 12539335, 36419069, 105971473, 308866226, 901573732, 2635235789, 7712078755, 22594899002, 66266698424, 194531585078, 571561286576, 1680679630089, 4945738222801
Offset: 0

Views

Author

Peter Luschny, Aug 30 2011

Keywords

Crossrefs

Programs

  • Maple
    A189912 := n -> add(n!/((n-k)!*iquo(k,2)!^2 *(iquo(k,2)+1)),k=0..n):
    A194588 := n -> `if`(n=0,1,A189912(n-1)-A194588(n-1)):
  • Mathematica
    a[0] = 1; a[n_] := a[n] = Sum[(n-1)!/((n-k-1)!*Quotient[k, 2]!^2*(1 + Quotient[k, 2])), {k, 0, n-1}] - a[n-1]; Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Jul 30 2013 *)

Formula

a(n) = ((n+1) mod 2) + (1/2)*sum_{k=1..n}((-1)^k*binomial(n,k)*((k+1)/2)^(k mod 2)*(k+1)$+2*(-1)^n*(2*k)$/(k+1)), where n$ denotes the swinging factorial A056040(n).

A163649 Triangle interpolating between (-1)^n (A033999) and A056040(n), read by rows.

Original entry on oeis.org

1, -1, 1, 1, -2, 2, -1, 3, -6, 6, 1, -4, 12, -24, 6, -1, 5, -20, 60, -30, 30, 1, -6, 30, -120, 90, -180, 20, -1, 7, -42, 210, -210, 630, -140, 140, 1, -8, 56, -336, 420, -1680, 560, -1120, 70
Offset: 0

Views

Author

Peter Luschny, Aug 02 2009

Keywords

Comments

Given T(n,k) = (-1)^(n-k)*floor(k/2)!^(-2)*n!/(n-k)!, let A(n,k) = abs(T(n,k)) be the coefficients of the polynomials Sum_{k=0..n} binomial(n,k)*A056040(k)*q^k. Substituting q^k -> 1/(floor(k/2)+1) in the polynomials gives the extended Motzkin numbers A189912. (See A089627 for the Motzkin numbers and A194586 for the complementary Motzkin numbers.)

Examples

			1
-1, 1
1, -2, 2
-1, 3, -6, 6
1, -4, 12, -24, 6
-1, 5, -20, 60, -30, 30
1, -6, 30, -120, 90, -180, 20
-1, 7, -42, 210, -210, 630, -140, 140
1, -8, 56, -336, 420, -1680, 560, -1120, 70
		

Crossrefs

Row sums give A163650, row sums of absolute values give A163865.
Aerated versions A194586 (odd case) and A089627 (even case).

Programs

  • Maple
    a := proc(n,k) (-1)^(n-k)*floor(k/2)!^(-2)*n!/(n-k)! end:
    seq(print(seq(a(n,k),k=0..n)),n=0..8);
  • Mathematica
    t[n_, k_] := (-1)^(n - k)*Floor[k/2]!^(-2)*n!/(n - k)!; Table[t[n, k], {n, 0, 8}, {k, 0, n}] // Flatten (* Jean-François Alcover, Jul 29 2013 *)
  • PARI
    for(n=0,10, for(k=0,n, print1((-1)^(n -k)*( (floor(k/2))! )^(-2)*(n!/(n - k)!), ", "))) \\ G. C. Greubel, Aug 01 2017

Formula

T(n,k) = (-1)^(n-k)*floor(k/2)!^(-2)*n!/(n-k)!.
E.g.f.: egf(x,y) = exp(-x)*BesselI(0,2*x*y)*(1+x*y).

A217539 Number of Dyck paths of semilength n which satisfy the condition: number of returns + number of hills < number of peaks.

Original entry on oeis.org

0, 0, 0, 1, 4, 17, 66, 252, 946, 3523, 13054, 48248, 178146, 657813, 2430962, 8995521, 33342588, 123822171, 460772982, 1718304786, 6421729878, 24051429321, 90272123682, 339522804129, 1279556832780, 4831639423695, 18278491474726, 69272752632502, 262981858878706
Offset: 0

Views

Author

Peter Luschny, Oct 22 2012

Keywords

Comments

David Scambler observed that [1, 0, A113682(n-2)] for n>=2 count the Dyck paths of semilength n which satisfy the condition "number of peaks = number of returns + number of hills" and [1, A189912(n-1)] for n>=1 count the paths which satisfy the condition "number of peaks <= number of returns + number of hills".

Examples

			a(4) = 4 count the Dyck words
[11010100] (()()()) [11011000] (()(()))
[11100100] ((())()) [11101000] ((()())) .
		

Crossrefs

Cf. A217540.

Programs

  • Maple
    A217539 := proc(n) local k; if n = 0 then 0 else (2*n)!/(n!^2*(n+1)) - add((n-1)!/(((n-1-k)!*iquo(k,2)!^2)*(iquo(k,2)+1)), k=0..n-1) fi end: seq(A217539(i), i=0..28);
  • Mathematica
    MotzkinNumber[n_] := Sum[ Binomial[n+1, k]*Binomial[n+1-k, k-1], {k, 0, Ceiling[(n+1)/2]}]/(n+1); a[0] = a[1] = 0; a[n_] := CatalanNumber[n] - (n-1)*MotzkinNumber[n-2] - MotzkinNumber[n-1]; Table[a[n], {n, 0, 28}] (* Jean-François Alcover, Jun 27 2013, from 3rd formula *)
  • Sage
    def A217539(n):
        @CachedFunction
        def M(n): return (3*(n-1)*M(n-2)+(2*n+1)*M(n-1))/(n+2) if n>1 else 1
        @CachedFunction
        def catalan(n): return ((4*n-2)*catalan(n-1))/(n+1) if n>0 else 1
        return catalan(n) - (n-1)*M(n-2) - M(n-1) if n!=0 else 0
    [A217539(i) for i in (0..28)]

Formula

a(n) = Sum_{k < 0} A217540(n, k).
a(n) = A000108(n) - A189912(n-1) for n > 0.
a(n) = C(n)-(n-1)*M(n-2)-M(n-1) for n > 0; C(n) Catalan, M(n) Motzkin numbers.
Conjecture: 2*(n+1)*(n-3)*a(n) +(-15*n^2+53*n-12)*a(n-1) +(28*n^2-157*n+165)*a(n-2) + 3*(3*n^2+2*n-26)*a(n-3) -18*(2*n-7)*(n-4)*a(n-4)=0. - R. J. Mathar, Nov 11 2012

A217540 Scambler statistic on Dyck paths. Triangle T(n, k) read by rows, n >= 0, -n <= k <= n, T(n, k) is the number of Dyck paths of semilength n and k = number of returns + number of hills - number of peaks.

Original entry on oeis.org

1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 2, 0, 1, 0, 0, 1, 3, 4, 2, 3, 0, 1, 0, 0, 1, 6, 10, 9, 8, 3, 4, 0, 1, 0, 0, 1, 10, 25, 30, 26, 17, 13, 4, 5, 0, 1, 0, 0, 1, 15, 56, 90, 90, 70, 49, 27, 19, 5, 6, 0, 1, 0, 0, 1, 21, 112, 245, 301, 266, 197, 128, 80, 39, 26, 6, 7, 0, 1
Offset: 0

Views

Author

Peter Luschny, Oct 21 2012

Keywords

Examples

			[n\k] -8,-7,-6, -5,  -4,  -3,  -2,  -1,  0,   1,  2,  3,  4, 5, 6, 7, 8
-----------------------------------------------------------------------
[ 0 ]                                    1,
[ 1 ]                               0,   0,   1,
[ 2 ]                          0,   0,   1,   0,  1,
[ 3 ]                     0,   0,   1,   1,   2,  0,  1,
[ 4 ]                0,   0,   1,   3,   4,   2,  3,  0,  1,
[ 5 ]           0,   0,   1,   6,  10,   9,   8,  3,  4,  0, 1,
[ 6 ]       0,  0,   1,  10,  25,  30,  26,  17, 13,  4,  5, 0, 1,
[ 7 ]    0, 0,  1,  15,  56,  90,  90,  70,  49, 27, 19,  5, 6, 0, 1,
[ 8 ] 0, 0, 1, 21, 112, 245, 301, 266, 197, 128, 80, 39, 26, 6, 7, 0, 1
.
T(5, -2) = 6 counting the Dyck words
[1101011000] (()()(())) [1101100100] (()(())()) [1101101000] (()(()()))
[1110010100] ((())()()) [1110100100] ((()())()) [1110101000] ((()()())) .
		

Programs

  • Maple
    b:= proc(x, y, t) option remember; `if`(y<0 or y>x, 0,
          `if`(x=0, z, expand(`if`(y=0, z, 1)*(b(x-1, y+1, true)
          +b(x-1, y-1, false)*`if`(t and y<>1, 1/z, 1)))))
        end:
    T:= n-> `if`(n=0, 1, (p-> seq(coeff(p, z, i), i=-n..n))
                         (b(2*n-1, 1, true))):
    seq(T(n), n=0..10);  # Alois P. Heinz, Jun 10 2014
  • Mathematica
    b[x_, y_, t_] := b[x, y, t] = If[y<0 || y>x, 0, If[x == 0, z, Expand[If[y == 0, z, 1]*(b[x-1, y+1, True]+b[x-1, y-1, False]*If[t && y != 1, 1/z, 1])]]]; T[n_] := If[n == 0, 1, Function[p, Table[Coefficient[p, z, i], {i, -n, n}]][b[2*n-1, 1, True]]]; Table[T[n], {n, 0, 10}] // Flatten (* Jean-François Alcover, Oct 24 2016, after Alois P. Heinz *)
  • Sage
    def A217540(n, k):
        def characteristic(d):
            count = 1
            h = d.heights()
            for i in (1..len(d)-1):
                if d[i-1]==1 and d[i]==0: count -= 1
                if h[i]==0: count +=1
                else:
                    if h[i-1]==0 and h[i+1]==0: count += 1
            return count
        if n == 0: return 1
        count = 0
        for d in DyckWords(n):
            if k == characteristic(d): count += 1
        return count
    for n in (0..6): [A217540(n, k) for k in (-n..n)]

Formula

T(n,-1) = A014531(n-2) = [0,0,0],1,3,10,30,90,...
T(n, 0) = A113682(n-2) = [1,0],1,1,4,9,26,70,197,...
T(n, 1) = A194588(n-1) = [0],1,0,2,2,8,17,49,128,...
Sum(k>=0,T(n,k)) = A189912(n-1) = [1],1,2,4,10,25, 66,177,..
Sum(k< 0,T(n,k)) = A217539(n) = 0,0,0,1, 4,17, 66,252,..
Sum(-n<=k<=n,T(n,k)) = A000108(n) = 1,1,2,5,14,42,132,429,..

A194589 a(n) = A194588(n) - A005043(n); complementary Riordan numbers.

Original entry on oeis.org

0, 0, 1, 1, 5, 11, 34, 92, 265, 751, 2156, 6194, 17874, 51702, 149941, 435749, 1268761, 3700391, 10808548, 31613474, 92577784, 271407896, 796484503, 2339561795, 6877992334, 20236257626, 59581937299, 175546527727, 517538571125, 1526679067331, 4505996000730
Offset: 0

Views

Author

Peter Luschny, Aug 30 2011

Keywords

Comments

The inverse binomial transform of a(n) is A194590(n).

Crossrefs

Programs

  • Maple
    # First method, describes the derivation:
    A056040 := n -> n!/iquo(n,2)!^2:
    A057977 := n -> A056040(n)/(iquo(n,2)+1);
    A001006 := n -> add(binomial(n,k)*A057977(k)*irem(k+1,2),k=0..n):
    A005043 := n -> `if`(n=0,1,A001006(n-1)-A005043(n-1)):
    A189912 := n -> add(binomial(n,k)*A057977(k),k=0..n):
    A194588 := n -> `if`(n=0,1,A189912(n-1)-A194588(n-1)):
    A194589 := n -> A194588(n)-A005043(n):
    # Second method, more efficient:
    A100071 := n -> A056040(n)*(n/2)^(n-1 mod 2):
    A194589 := proc(n) local k;
    (n mod 2)+(1/2)*add((-1)^k*binomial(n,k)*A100071(k+1),k=1..n) end:
    # Alternatively:
    a := n -> `if`(n<3,iquo(n,2),hypergeom([1-n/2,-n,3/2-n/2],[1,2-n],4)): seq(simplify(a(n)), n=0..30); # Peter Luschny, Mar 07 2017
  • Mathematica
    sf[n_] := With[{f = Floor[n/2]}, Pochhammer[f+1, n-f]/f!]; a[n_] := Mod[n, 2] + (1/2)*Sum[(-1)^k*Binomial[n, k]*2^-Mod[k, 2]*(k+1)^Mod[k, 2]*sf[k+1], {k, 1, n}]; Table[a[n], {n, 0, 10}] (* Jean-François Alcover, Jul 30 2013, from 2nd method *)
    Table[If[n < 3, Quotient[n, 2], HypergeometricPFQ[{1 - n/2, -n, 3/2 - n/2}, {1, 2-n}, 4]], {n,0,30}] (* Peter Luschny, Mar 07 2017 *)
  • Maxima
    a(n):=sum(binomial(n+2,k)*binomial(n-k,k),k,0,(n)/2); /* Vladimir Kruchinin, Sep 28 2015 */
    
  • PARI
    a(n) = sum(k=0, n/2, binomial(n+2,k)*binomial(n-k,k));
    vector(30, n, a(n-3)) \\ Altug Alkan, Sep 28 2015

Formula

a(n) = sum_{k=0..n} C(n,k)*A194590(k).
a(n) = (n mod 2)+(1/2)*sum_{k=1..n} (-1)^k*C(n,k)*(k+1)$*((k+1)/2)^(k mod 2). Here n$ denotes the swinging factorial A056040(n).
a(n) = PSUMSIGN([0,0,1,2,6,16,45,..] = PSUMSIGN([0,0,A005717]) where PSUMSIGN is from Sloane's "Transformations of integer sequences". - Peter Luschny, Jan 17 2012
A(x) = B'(x)*(1/x^2-1/(B(x)*x)), where B(x)/x is g.f. of A005043. - Vladimir Kruchinin, Sep 28 2015
a(n) = Sum_{k=0..n/2} C(n+2,k)*C(n-k,k). - Vladimir Kruchinin, Sep 28 2015
a(n) = hypergeom([1-n/2,-n,3/2-n/2],[1,2-n],4) for n>=3. - Peter Luschny, Mar 07 2017
a(n) ~ 3^(n + 1/2) / (8*sqrt(Pi*n)). - Vaclav Kotesovec, Feb 17 2024

A359364 Triangle read by rows. The Motzkin triangle, the coefficients of the Motzkin polynomials. M(n, k) = binomial(n, k) * CatalanNumber(k/2) if k is even, otherwise 0.

Original entry on oeis.org

1, 1, 0, 1, 0, 1, 1, 0, 3, 0, 1, 0, 6, 0, 2, 1, 0, 10, 0, 10, 0, 1, 0, 15, 0, 30, 0, 5, 1, 0, 21, 0, 70, 0, 35, 0, 1, 0, 28, 0, 140, 0, 140, 0, 14, 1, 0, 36, 0, 252, 0, 420, 0, 126, 0, 1, 0, 45, 0, 420, 0, 1050, 0, 630, 0, 42, 1, 0, 55, 0, 660, 0, 2310, 0, 2310, 0, 462, 0
Offset: 0

Views

Author

Peter Luschny, Jan 09 2023

Keywords

Comments

The generalized Motzkin numbers M(n, k) are a refinement of the Motzkin numbers M(n) (A001006) in the sense that they are coefficients of polynomials M(n, x) = Sum_{n..k} M(n, k) * x^k that take the value M(n) at x = 1. The coefficients of x^n are the aerated Catalan numbers A126120.
Variants are the irregular triangle A055151 with zeros deleted, A097610 with reversed rows, A107131 and A080159.
In the literature the name 'Motzkin triangle' is also used for the triangle A026300, which is generated from the powers of the generating function of the Motzkin numbers.

Examples

			Triangle M(n, k) starts:
[0] 1;
[1] 1, 0;
[2] 1, 0,  1;
[3] 1, 0,  3, 0;
[4] 1, 0,  6, 0,   2;
[5] 1, 0, 10, 0,  10, 0;
[6] 1, 0, 15, 0,  30, 0,   5;
[7] 1, 0, 21, 0,  70, 0,  35, 0;
[8] 1, 0, 28, 0, 140, 0, 140, 0,  14;
[9] 1, 0, 36, 0, 252, 0, 420, 0, 126, 0;
		

Crossrefs

Cf. A001006 (Motzkin numbers), A026300 (Motzkin gf. triangle), A126120 (aerated Catalan), A000108 (Catalan).

Programs

  • Maple
    CatalanNumber := n -> binomial(2*n, n)/(n + 1):
    M := (n, k) -> ifelse(irem(k, 2) = 1, 0, CatalanNumber(k/2)*binomial(n, k)):
    for n from 0 to 9 do seq(M(n, k), k = 0..n) od;
    # Alternative, as coefficients of polynomials:
    p := n -> hypergeom([(1 - n)/2, -n/2], [2], (2*x)^2):
    seq(print(seq(coeff(simplify(p(n)), x, k), k = 0..n)), n = 0..9);
    # Using the exponential generating function:
    egf := exp(x)*BesselI(1, 2*x*t)/(x*t): ser:= series(egf, x, 11):
    seq(print(seq(coeff(simplify(n!*coeff(ser, x, n)), t, k), k = 0..n)), n = 0..9);
  • Python
    from functools import cache
    @cache
    def M(n: int, k: int) -> int:
        if k %  2: return 0
        if n <  3: return 1
        if n == k: return (2 * (n - 1) * M(n - 2, n - 2)) // (n // 2 + 1)
        return (M(n - 1, k) * n) // (n - k)
    for n in range(10): print([M(n, k) for k in range(n + 1)])

Formula

Let p(n, x) = hypergeom([(1 - n)/2, -n/2], [2], (2*x)^2).
p(n, 1) = A001006(n); p(n, sqrt(2)) = A025235(n); p(n, 2) = A091147(n).
p(2, n) = A002522(n); p(3, n) = A056107(n).
p(n, n) = A359649(n); 2^n*p(n, 1/2) = A000108(n+1).
M(n, k) = [x^k] p(n, x).
M(n, k) = [t^k] (n! * [x^n] exp(x) * BesselI(1, 2*t*x) / (t*x)).
M(n, k) = [t^k][x^n] ((1 - x - sqrt((x-1)^2 - (2*t*x)^2)) / (2*(t*x)^2)).
M(n, n) = A126120(n).
M(n, n-1) = A138364(n), the number of Motzkin n-paths with exactly one flat step.
M(2*n, 2*n) = A000108(n), the number of peakless Motzkin paths having a total of n up and level steps.
M(4*n, 2*n) = A359647(n), the central terms without zeros.
M(2*n+2, 2*n) = A002457(n) = (-4)^n * binomial(-3/2, n).
Sum_{k=0..n} M(n - k, k) = A023426(n).
Sum_{k=0..n} k * M(n, k) = 2*A014531(n-1) = 2*GegenbauerC(n - 2, -n, -1/2).
Sum_{k=0..n} i^k*M(n, k) = A343773(n), (i the imaginary unit), is the excess of the number of even Motzkin n-paths (A107587) over the odd ones (A343386).
Sum_{k=0..n} Sum_{j=0..k} M(n, j) = A189912(n).
Sum_{k=0..n} Sum_{j=0..k} M(n, n-j) = modified A025179(n).
For a recursion see the Python program.

A189913 Triangle read by rows: T(n,k) = binomial(n, k) * k! / (floor(k/2)! * floor((k+2)/2)!).

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 3, 3, 3, 1, 4, 6, 12, 2, 1, 5, 10, 30, 10, 10, 1, 6, 15, 60, 30, 60, 5, 1, 7, 21, 105, 70, 210, 35, 35, 1, 8, 28, 168, 140, 560, 140, 280, 14, 1, 9, 36, 252, 252, 1260, 420, 1260, 126, 126, 1, 10, 45, 360, 420, 2520, 1050, 4200, 630, 1260, 42
Offset: 0

Views

Author

Peter Luschny, May 24 2011

Keywords

Comments

The triangle may be regarded a generalization of the triangle A097610:
A097610(n,k) = binomial(n,k)*(2*k)$/(k+1);
T(n,k) = binomial(n,k)*(k)$/(floor(k/2)+1).
Here n$ denotes the swinging factorial A056040(n). As A097610 is a decomposition of the Motzkin numbers A001006, a combinatorial interpretation of T(n,k) in terms of lattice paths can be expected.
T(n,n) = A057977(n) which can be seen as extended Catalan numbers.

Examples

			[0]  1
[1]  1, 1
[2]  1, 2,  1
[3]  1, 3,  3,   3
[4]  1, 4,  6,  12,  2
[5]  1, 5, 10,  30, 10,  10
[6]  1, 6, 15,  60, 30,  60,  5
[7]  1, 7, 21, 105, 70, 210, 35, 35
		

Crossrefs

Row sums are A189912.

Programs

  • Magma
    /* As triangle */ [[Binomial(n,k)*Factorial(k)/(Factorial(Floor(k/2))*Factorial(Floor((k + 2)/2))): k in [0..n]]: n in [0..10]]; // G. C. Greubel, Jan 13 2018
  • Maple
    A189913 := (n,k) -> binomial(n,k)*(k!/iquo(k,2)!^2)/(iquo(k,2)+1):
    seq(print(seq(A189913(n,k),k=0..n)),n=0..7);
  • Mathematica
    T[n_, k_] := Binomial[n, k]*k!/((Floor[k/2])!*(Floor[(k + 2)/2])!); Table[T[n, k], {n, 0, 10}, {k, 0, n}]// Flatten (* G. C. Greubel, Jan 13 2018 *)
  • PARI
    {T(n,k) = binomial(n,k)*k!/((floor(k/2))!*(floor((k+2)/2))!) };
    for(n=0,10, for(k=0,n, print1(T(n,k), ", "))) \\ G. C. Greubel, Jan 13 2018
    

Formula

From R. J. Mathar, Jun 07 2011: (Start)
T(n,1) = n.
T(n,2) = A000217(n-1).
T(n,3) = A027480(n-2).
T(n,4) = A034827(n). (End)

A274883 Triangle read by rows, T(n,k) = 2^k*binomial(n,k)*A057977(n-k) for n>=0 and 0<=k<=n.

Original entry on oeis.org

1, 1, 2, 1, 4, 4, 3, 6, 12, 8, 2, 24, 24, 32, 16, 10, 20, 120, 80, 80, 32, 5, 120, 120, 480, 240, 192, 64, 35, 70, 840, 560, 1680, 672, 448, 128, 14, 560, 560, 4480, 2240, 5376, 1792, 1024, 256, 126, 252, 5040, 3360, 20160, 8064, 16128, 4608, 2304, 512
Offset: 0

Views

Author

Peter Luschny, Jul 14 2016

Keywords

Examples

			Triangle starts:
                       1;
                      1, 2;
                    1, 4, 4;
                  3, 6, 12, 8;
               2, 24, 24, 32, 16;
            10, 20, 120, 80, 80, 32;
         5, 120, 120, 480, 240, 192, 64;
     35, 70, 840, 560, 1680, 672, 448, 128;
14, 560, 560, 4480, 2240, 5376, 1792, 1024, 256;
		

Crossrefs

Cf. A000079 (T(n,n)), A057977 (T(n,0)), A077587 (row sum).
Cf. A189912. Row reversed A091894 is a subtriangle.

Programs

  • Maple
    T := (n,k) -> 2^k*binomial(n,k)*((n-k)!/floor((n-k)/2)!^2)/(floor((n-k)/2)+1);
    seq(seq(T(n,k), k=0..n), n=0..9);
Showing 1-8 of 8 results.