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.

User: Ira M. Gessel

Ira M. Gessel's wiki page.

Ira M. Gessel has authored 12 sequences. Here are the ten most recent ones:

A317111 Number of permutations of [n] in which the length of every increasing run is 0 or 1 (mod 4).

Original entry on oeis.org

1, 1, 1, 1, 2, 10, 50, 210, 840, 4200, 29400, 231000, 1755600, 13213200, 109309200, 1051050000, 11099088000, 120071952000, 1320791472000, 15317750448000, 192286654560000, 2577944809440000, 35885904294240000, 513695427204960000, 7641940962015360000
Offset: 0

Author

Ira M. Gessel, Jul 21 2018

Keywords

Comments

Similarly, 1/(1 - x + x^2/2! - ... - x^(2m-1)/(2m-1)!) is the e.g.f. for permutations in which every increasing run has length 0 or 1 (mod 2m).

Examples

			For n=4 the a(4)=2 permutations are 4321 and 1234.
		

Crossrefs

Programs

  • Magma
    m:=25; R:=PowerSeriesRing(Rationals(), m); b:=Coefficients(R!( 1/(1-x+x^2/2-x^3/6) )); [Factorial(n-1)*b[n]: n in [1..m]]; // G. C. Greubel, Nov 30 2018
    
  • Maple
    gser:=series(1/(1-x+x^2/2!-x^3/3!), x, 21): seq(n!*coeff(gser,x,n), n=0..20);
  • Mathematica
    With[{nmax = 25}, CoefficientList[Series[1/(1 -x +x^2/2! -x^3/3!), {x, 0, nmax}], x]*Range[0, nmax]!] (* G. C. Greubel, Nov 30 2018 *)
  • PARI
    my(x='x+O('x^25)); Vec(serlaplace(1/(1 -x +x^2/2 -x^3/6))) \\ G. C. Greubel, Nov 30 2018
    
  • Sage
    f= 1/(1 -x +x^2/2 -x^3/6)
    g=f.taylor(x,0,13)
    L=g.coefficients()
    coeffs={c[1]:c[0]*factorial(c[1]) for c in L}
    coeffs  # G. C. Greubel, Nov 30 2018

Formula

E.g.f.: 1/(1 - x + x^2/2! - x^3/3!).
a(0) = a(1) = a(2) = 1; a(n) = n * a(n-1) - n * (n-1) * a(n-2) / 2 + n * (n-1) * (n-2) * a(n-3) / 6 for n > 2. - Ilya Gutkovskiy, Jan 22 2024

A224917 Stable k-tree numbers.

Original entry on oeis.org

1, 1, 1, 2, 5, 15, 64, 342, 2344, 19137, 181204, 1927017, 22652805, 290392448, 4022276630, 59749492128, 946174967813, 15892939156209
Offset: 0

Author

Ira M. Gessel, Apr 19 2013

Keywords

Comments

a(n) is the number of unlabeled k-trees with n+k vertices for all k >= n-2.
A k-tree is recursively defined as follows: The complete graph K_k is a k-tree and a k-tree on n+1 vertices is obtained by joining a vertex to a k-clique in a k-tree on n vertices.

Crossrefs

Cf. A000055 (unlabeled trees), A054581 (unlabeled 2-trees), A078792 (unlabeled 3-trees), A078793 (unlabeled 4-trees), A201702 (unlabeled 5-trees), A202037 (unlabeled 6-trees).

A186371 Number of up-down runs in all permutations of {1,2,...,n}.

Original entry on oeis.org

0, 1, 3, 13, 68, 420, 3000, 24360, 221760, 2237760, 24796800, 299376000, 3911846400, 55005350400, 828193766400, 13294689408000, 226663557120000, 4090405423104000, 77895546753024000, 1561112121913344000, 32844177110384640000, 723788347432550400000
Offset: 0

Author

Emeric Deutsch and Ira M. Gessel, Mar 01 2011

Keywords

Comments

The up-down runs of a permutation p are the alternating runs of the permutation p endowed with a 0 in the front. For example, 75814632 has 6 up-down runs: 07, 75, 58, 81, 146, and 632.

Examples

			a(3)=13 because the permutations 123, 132, 213, 231, 312, and 321 have a total of 1 + 2 + 3 + 2 + 3 + 2 = 13 up-down runs.
		

Crossrefs

Programs

  • Magma
    [0,1] cat [Factorial(n)*(4*n+1)/6: n in [2..30]]; // Vincenzo Librandi, Sep 11 2015
  • Maple
    0, 1, seq((1/6)*factorial(n)*(4*n+1), n = 2 .. 20);
  • Mathematica
    Join[{0, 1}, Table[n! (4 n + 1)/6, {n, 2, 20}]] (* Vincenzo Librandi, Sep 11 2015 *)

Formula

a(n) = Sum_{k=1..n} k*A186370(n,k).
a(n) = n!*(4n+1)/6 for n>=2.
E.g.f.: g(z) = z(6-3z+z^2)/[6(1-z)^2].
D-finite with recurrence 4*a(n) +(-4*n-7)*a(n-1) +3*(n-1)*a(n-2)=0. - R. J. Mathar, Jul 22 2022

A186370 Triangle read by rows: T(n,k) is the number of permutations of {1,2,...,n} having k up-down runs (1 <= k <= n).

Original entry on oeis.org

1, 1, 1, 1, 3, 2, 1, 7, 11, 5, 1, 15, 43, 45, 16, 1, 31, 148, 268, 211, 61, 1, 63, 480, 1344, 1767, 1113, 272, 1, 127, 1509, 6171, 12099, 12477, 6551, 1385, 1, 255, 4661, 26955, 74211, 111645, 94631, 42585, 7936, 1, 511, 14246, 114266, 425976, 878856, 1070906, 770246, 303271, 50521
Offset: 1

Author

Emeric Deutsch and Ira M. Gessel, Mar 01 2011

Keywords

Comments

The up-down runs of a permutation p are the alternating runs of the permutation p endowed with a 0 in the front. For example, 75814632 has 6 up-down runs: 07, 75, 58, 81, 146, and 632.

Examples

			T(3,2) = 3 because we have 132, 231, and 321.
T(4,4) = 5 because we have 13254, 14253, 14352, 15243, and 15342 (the up-down permutations).
Triangle starts:
1;
1,  1;
1,  3,  2;
1,  7, 11,  5;
1, 15, 43, 45, 16;
		

Crossrefs

Row sums give A000142.
T(2n,n) gives A291677, T(2n+1,n+1) gives A303159, T(n,ceiling(n/2)) gives A303160.

Programs

  • Maple
    w := sqrt(1-t^2): G := (w^2+t*w*sinh(z*w))/((1+t)*(1-t*cosh(z*w)))-1: Gser := simplify(series(G, z = 0, 12)): for n to 10 do P[n] := sort(expand(factorial(n)*coeff(Gser, z, n))) end do: for n to 10 do seq(coeff(P[n], t, k), k = 1 .. n) end do; # yields sequence in triangular form
    # second Maple program:
    b:= proc(u, o) option remember; expand(`if`(u+o=0, 1,
           add(b(o+j-1, u-j)*x, j=1..u)+
           add(b(u+j-1, o-j),   j=1..o)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=1..n))(b(n, 0)):
    seq(T(n), n=1..12);  # Alois P. Heinz, Aug 29 2017, Apr 17 2018
  • Mathematica
    b[u_, o_, t_] := b[u, o, t] = Expand[If[u + o == 0, 1, Sum[b[u - j, o + j - 1, 0]*x^t, {j, 1, u}] + Sum[b[u + j - 1, o - j, 1]*x^(1-t), {j, 1, o}]]];
    T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 1, n}]][b[0, n, 0]];
    Table[T[n], {n, 1, 12}] // Flatten (* Jean-François Alcover, Nov 06 2017, after Alois P. Heinz *)
  • Sage
    @CachedFunction
    def A186370(n, k):
        if n == 0 or  k == 0: return 0
        if n == 1 and k == 1: return 1
        return k*A186370(n-1, k) + A186370(n-1, k-1) + (n-k+1)*A186370(n-1, k-2)
    for n in (1..7): [A186370(n, k) for k in (1..n)] # Peter Luschny, Apr 18 2014

Formula

T(n,2) = 2^{n-1}-1 = A000225(n-1).
T(n,n) = A000111(n) (the Euler or up-down numbers).
Sum_{k=1..n} k*T(n,k) = A186371(n).
E.g.f.: G(t,z) = Sum_{n>=1} Sum_{k>=1} T(n,k) * t^k * z^n / n! = (w^2 + tw*sinh(zw))/[(1+t)(1-t*cosh(zw))]-1, where w=sqrt(1-t^2).
The e.g.f. G(t,z) satisfies the linear homogeneous partial differential equation (1-t^2*z)(dG/dz)-t(1-t^2)dG/dt = tG; G(0,z)=1.
Recurrence: T(n,k) = k*T(n-1,k) + T(n-1,k-1) + (n-k+1)*T(n-1,k-2); T(n,0) = T(0,k) = 0, T(1,1) = 1.

A132892 Square array T(m,n) read by antidiagonals; T(m,n) is the number of equivalence classes in the set of sequences of n nonnegative integers that sum to m, generated by the equivalence relation defined in the following manner: we write a sequence in the form a[1]0a[2]0...0a[p], where each a[i] is a (possibly empty) sequence of positive integers; two sequences in this form, a[1]0a[2]0...0a[p] and b[1]0b[2]0...0b[q] are said to be equivalent if p=q and b[1],b[2],...,b[q] is a cyclic permutation of a[1],a[2],...a[p].

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 3, 3, 1, 1, 4, 5, 3, 1, 1, 5, 9, 7, 4, 1, 1, 6, 13, 14, 10, 4, 1, 1, 7, 19, 25, 22, 12, 5, 1, 1, 8, 25, 41, 42, 30, 15, 5, 1, 1, 9, 33, 63, 79, 66, 43, 19, 6, 1, 1, 10, 41, 92, 131, 132, 99, 55, 22, 6, 1, 1, 11, 51, 129, 213, 245, 217, 143, 73, 26, 7, 1, 1, 12, 61, 175, 325, 428, 429, 335, 201, 91, 31, 7, 1
Offset: 1

Author

Emeric Deutsch and Ira M. Gessel, Oct 02 2007

Keywords

Comments

T(n,n) = A000108(n) (the Catalan numbers; see R. P. Stanley, Catalan addendum, problem starting "Equivalence classes of the equivalence relation ..."). T(m,m+1) = A007595(m+1); T(m,m+2) = A003441(m+1); T(m,m+3) = A003444(m+3); T(n+2,n) = A001453(n+1) (Catalan numbers - 1); T(m,1)=1; T(m,2)=m; T(m,3) = A080827(m) = A099392(m+1); T(m,4) = A004006(m).

Examples

			T(2,4) = 3 because we have {2000, 0200, 0020, 0002}, {1100, 0110, 0011} and {1010, 0101, 1001}.
T(4,2) = 4 because we have {40, 04}, {31}, {13} and {22}.
The square array starts:
  1....1.....1.....1......1.....1.....1...
  1....2.....3.....3......4.....4.....5...
  1....3.....5.....7.....10....12....15...
  1....4.....9....14.....22....30....43...
  1....5....13....25.....42....66....99...
		

Programs

  • Maple
    with(numtheory): T:=proc(m,n) local r, div, N: r:=igcd(m,n+1): div:=divisors(r): N:=nops(div): (sum(phi(div[j])*(binomial((m+n+1)/div[j]-1,(n+1)/div[j]-1) -binomial(m/div[j]-1,(n+1)/div[j]-1)),j=1..N))/(n+1) end proc: for m to 12 do seq(T(m, n),n=1..12) end do; # yields the upper left 12 by 12 block of the infinite matrix T(m,n)
    # second Maple program:
    T:= proc(m, n) uses numtheory; (C-> add(phi(d)*(C((m+n+1)/d-1, (n+1)/d-1)
          -C(m/d-1, (n+1)/d-1))/(n+1), d=divisors(igcd(m, n+1))))(binomial)
        end:
    seq(seq(T(1+d-n, n), n=1..d), d=1..14);  # Alois P. Heinz, Jan 28 2025
  • Mathematica
    T[m_, n_] := Module[{r, div, N}, r = GCD[m, n + 1]; div = Divisors[r]; N = Length[div]; (Sum[EulerPhi[div[[j]]]*(Binomial[(m + n + 1)/div[[j]] - 1, (n + 1)/div[[j]] - 1] - Binomial[m/div[[j]] - 1, (n + 1)/div[[j]] - 1]), {j, 1, N}])/(n + 1)];
    Table[T[m - n + 1, n], {m, 1, 13}, {n, 1, m}] // Flatten (* Jean-François Alcover, Sep 01 2024, after Maple program *)

Formula

T(m,n) = Sum_{d | gcd(m,n+1)} phi(d)*(C((m+n+1)/d-1, (n+1)/d-1) - C(m/d-1, (n+1)/d-1))/(n+1). [corrected by Jason Yuen, Jan 28 2025]

A101281 Triangle read by rows: T(n,k) is the number of Schroeder paths of length 2n and having k low humps.

Original entry on oeis.org

1, 1, 1, 2, 3, 1, 8, 8, 5, 1, 36, 28, 18, 7, 1, 164, 120, 68, 32, 9, 1, 764, 552, 292, 136, 50, 11, 1, 3652, 2616, 1356, 608, 240, 72, 13, 1, 17852, 12680, 6532, 2880, 1140, 388, 98, 15, 1, 88868, 62664, 32156, 14128, 5572, 1976, 588, 128, 17, 1, 449004, 314744
Offset: 0

Author

Emeric Deutsch and Ira M. Gessel, Dec 20 2004

Keywords

Comments

A Schroeder path of length 2n is a lattice path starting from (0,0), ending at (2n,0), consisting only of steps U=(1,1) (up steps), D=(1,-1) (down steps) and H=(2,0) (level steps) and never going below the x-axis. A hump is an up step U followed by 0 or more level steps H followed by a down step D. A low hump is a hump that starts at height zero. Schroeder paths are counted by the large Schroeder numbers (A006318). Row sums are the large Schroeder numbers (A006318). Column 0 yields A089387.

Examples

			T(3,2) = 5 because we have (UD)(UHD), (UHD)(UD), H(UD)(UD), (UD)H(UD) and (UD)(UD)H, the low humps being shown between parentheses.
Triangle begins:
1;
1,1;
2,3,1;
8,8,5,1;
36,28,18,7,1;
		

Crossrefs

Programs

  • Maple
    G:=(-1+z)*(-1+z+sqrt(1-6*z+z^2))/z/(3-3*z-sqrt(1-6*z+z^2) -t+t*z +t*sqrt(1-6*z+z^2)): Gser:=simplify(series(G,z=0,12)): P[0]:=1: for n from 1 to 10 do P[n]:=coeff(Gser,z^n) od: seq(seq(coeff(t*P[n],t^k), k=1..n+1), n=0..10);

Formula

G.f.: G(t, z)=(1-z)R/[1-z+(1-t)zR], where R=[1-z-sqrt(1-6z+z^2)]/(2z) is the g.f. of the large Schroeder numbers (A006318).

A097971 Number of alternating runs in all permutations of [n] (the permutation 732569148 has four alternating runs: 732, 2569, 91 and 148).

Original entry on oeis.org

2, 10, 56, 360, 2640, 21840, 201600, 2056320, 22982400, 279417600, 3672345600, 51891840000, 784604620800, 12640852224000, 216202162176000, 3912561709056000, 74694359900160000, 1500289571708928000, 31627726106296320000, 698242876346695680000
Offset: 2

Author

Emeric Deutsch and Ira M. Gessel, Sep 07 2004

Keywords

Comments

a(n) is also equal to the sum over all permutations p in S(n) of the number of elements in the set {(i, j): 0 < i < j < n+1 and |i - j| = |p(i) - p(j)|}.

Examples

			a(3) = 10 because the permutations 123, 132, 312, 213, 231, 321 have the following alternating runs: 123, 13, 32, 31, 12, 21, 13, 23, 31 and 321.
		

References

  • M. Bona, Combinatorics of Permutations, Chapman & Hall/CRC, Boca Raton, FL, 2004, pp. 24-30.
  • D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, 1973, Vol. 3, pp. 46 and 587-8.

Crossrefs

Cf. A006157.

Programs

  • Maple
    seq(n!*(2*n-1)/3, n=2..20);

Formula

a(n) = n!(2n-1)/3. E.g.f.: x^2*(3-x)/[3(1-x)^2]. a(n) = 2*A006157(n).

A097898 Triangle read by rows: T(n,k) is the number of permutations of [n] with k runs of length 1. For example, 457/3/26/1 has two runs of length 1: 3 and 1.

Original entry on oeis.org

1, 0, 1, 1, 0, 1, 1, 4, 0, 1, 6, 6, 11, 0, 1, 19, 51, 23, 26, 0, 1, 109, 212, 269, 72, 57, 0, 1, 588, 1571, 1419, 1140, 201, 120, 0, 1, 4033, 10470, 13343, 7432, 4272, 522, 247, 0, 1, 29485, 87672, 107853, 87552, 33683, 14841, 1291, 502, 0, 1, 246042, 763612
Offset: 0

Author

Emeric Deutsch and Ira M. Gessel, Sep 03 2004

Keywords

Examples

			Triangle starts:
1;
0,1;
1,0,1;
1,4,0,1;
6,6,11,0,1;
19,51,23,26,0,1
Row n has n+1 terms.
T(3,0)=1, T(3,1)=4, T(3,2)=0 and T(3,3)=1 because we have 123, 13(2), (2)13, 23(1), (3)12, (3)(2)(1), the runs of length 1 being shown between parentheses.
		

References

  • Ira. M. Gessel, Generating functions and enumeration of sequences, Ph. D. Thesis, MIT, 1977.

Programs

  • Maple
    A:=(1-t)/2: B:=sqrt(t^2+2*t-3)/2: G:=B/exp(A*z)/(A*sinh(B*z)+B*cosh(B*z)-sinh(B*z)): Gserz:=simplify(series(G,z=0,12)): P[0]:=1: for n from 1 to 12 do P[n]:=sort(n!*coeff(Gserz,z^n)) od: seq(seq(coeff(t*P[n],t^k),k=1..n+1),n=0..10);

Formula

E.g.f.: Bexp(-Ax)/[A*sinh(Bx)+B*cosh(Bx)-sinh(Bx)], where A=(1-t)/2 and B=(1/2)sqrt(t^2+2t-3).

A097899 Number of permutations of [n] with no runs of length 1. (The permutation 3574162 has two runs of length 1: 357/4/16/2).

Original entry on oeis.org

1, 0, 1, 1, 6, 19, 109, 588, 4033, 29485, 246042, 2228203, 22162249, 237997032, 2757055393, 34191395785, 452480427678, 6360924613699, 94691284984405, 1487846074481172, 24608991911033377, 427379047337272213, 7775688853750498386, 147900024951747279643
Offset: 0

Author

Emeric Deutsch and Ira M. Gessel, Sep 03 2004

Keywords

Examples

			Example: a(4)=6 because 1234, 1324, 1423, 2314, 2413, 3412 are the only permutations of [4] with no runs of length 1.
		

References

  • Ira. M. Gessel, Generating functions and enumeration of sequences, Ph. D. Thesis, MIT, 1977, p. 52.

Crossrefs

Cf. A186735.

Programs

  • Maple
    G:=sqrt(3)*exp(-x/2)/2/cos(sqrt(3)*x/2+Pi/6): Gser:=series(G, x, 26): seq(n!*coeff(Gser, x, n), n=0..25);
  • Mathematica
    FullSimplify[CoefficientList[Series[(Sqrt[3]/2)*E^(-x/2)/Cos[Sqrt[3]*x/2 + Pi/6], {x, 0, 20}], x]* Range[0, 20]!] (* Vaclav Kotesovec, Oct 08 2013 *)
    g[u_, o_] := g[u, o] = If[u + o < 2, u,
         Sum[b[u - i, o + i - 1], {i, u}] +
         Sum[g[u + i - 1, o - i], {i, o}]];
    b[u_, o_] := b[u, o] = If[u + o < 2, 1 - o, u*(u + o - 1)! +
         Sum[g[u + i - 1, o - i], {i, o}]] ;
    a[n_] := n! - Sum[b[j - 1, n - j], {j, n}];
    Table[a[n], {n, 0, 25}] (* Jean-François Alcover, Aug 30 2021, after Alois P. Heinz in A228614 *)

Formula

a(n) = A000142(n) - A228614(n).
E.g.f.: (sqrt(3)/2)exp(-x/2)/cos(sqrt(3)x/2 + Pi/6).
E.g.f.: 1/(1-x^2/2!-x^3/3! +x^5/5! + x^6/6! - x^8/8! -x^9/9! + ... ) - Ira M. Gessel, Jul 27 2014
a(n) ~ n! * exp(-Pi*sqrt(3)/9) * (3*sqrt(3)/(2*Pi))^(n+1). - Vaclav Kotesovec, Oct 08 2013
G.f.: T(0), where T(k) = 1 - x^2*(k+1)^2/( x^2*(k+1)^2 - (1-x*(k+1))*(1-x*k)/T(k+1) ); (continued fraction). - Sergei N. Gladkovskii, Dec 03 2013

A097900 Number of runs of length 1 in all permutations of [n]. (The permutation 3574162 has two runs of length 1: 357/4/16/2.)

Original entry on oeis.org

1, 2, 7, 32, 180, 1200, 9240, 80640, 786240, 8467200, 99792000, 1277337600, 17643225600, 261534873600, 4140968832000, 69742632960000, 1244905998336000, 23475370254336000, 466306218233856000, 9731608032706560000
Offset: 1

Author

Emeric Deutsch and Ira M. Gessel, Sep 03 2004

Keywords

Comments

a(n) is the number of corners in the set of tree-like tableaux of size n (see Gao et al. link). - Michel Marcus, Nov 18 2015

Examples

			a(3) = 7 because there are 7 runs of length 1 in the permutations 123, 13(2), (2)13, 23(1), (3)12, (3)(2)(1) (shown between parentheses).
		

Crossrefs

Cf. A159920.

Programs

  • Magma
    [1] cat [Factorial(n)*(n+4)/6: n in [2..25]]; // Vincenzo Librandi, Nov 18 2015
    
  • Maple
    seq(ceil(n!*(n+4)/6),n=1..23);
  • Mathematica
    Join[{1}, Table[n! (n + 4)/6, {n, 2, 20}]] (* Vincenzo Librandi, Nov 18 2015 *)
    Rest[With[{nmax = 50}, CoefficientList[Series[x*(6 - 6*x + x^2)/(6*(1 - x)^2), {x, 0, nmax}], x]*Range[0, nmax]!]] (* G. C. Greubel, Dec 20 2017 *)
  • PARI
    my(x='x+O('x^30)); Vec(serlaplace(x*(6-6*x+x^2)/(6*(1-x)^2))) \\ G. C. Greubel, Dec 20 2017
    
  • PARI
    a(n) = if(n==1, 1, n!*(n+4)/6); \\ Altug Alkan, Dec 21 2017

Formula

a(n) = n!*(n+4)/6 for n >= 2.
E.g.f.: x*(6-6*x+x^2)/(6*(1-x)^2).
a(n) = (A159920(n)*(n-2)!)/ 2 for n >= 2. - Cullen M. Vaney, Jul 14 2025