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

A010027 Triangle read by rows: T(n,k) is the number of permutations of [n] having k consecutive ascending pairs (0 <= k <= n-1).

Original entry on oeis.org

1, 1, 1, 1, 2, 3, 1, 3, 9, 11, 1, 4, 18, 44, 53, 1, 5, 30, 110, 265, 309, 1, 6, 45, 220, 795, 1854, 2119, 1, 7, 63, 385, 1855, 6489, 14833, 16687, 1, 8, 84, 616, 3710, 17304, 59332, 133496, 148329, 1, 9, 108, 924, 6678, 38934, 177996, 600732, 1334961, 1468457, 1
Offset: 1

Views

Author

Keywords

Comments

A "consecutive ascending pair" in a permutation p_1, p_2, ..., p_n is a pair p_i, p_{i+1} = p_i + 1.
From Emeric Deutsch, May 15 2010: (Start)
The same triangle, but with rows indexed differently, also arises as follows: U(n,k) = number of permutations of [n] having k blocks (1 <= k <= n), where a block of a permutation is a maximal sequence of consecutive integers which appear in consecutive positions. For example, the permutation 5412367 has 4 blocks: 5, 4, 123, and 67.
When seen as coefficients of polynomials with decreasing exponents: evaluations are A001339 (x=2), A081923 (x=3), A081924 (x=4), A087981 (x=-1).
The sum of the entries in row n is n!.
U(n,n) = A000255(n-1) = d(n-1) + d(n), U(n,n-1)=d(n), where d(j)=A000166(j) (derangement numbers). (End)
This is essentially the reversal of the exponential Riordan array [exp(-x)/(1-x)^2,x] (cf. A123513). - Paul Barry, Jun 17 2010
U(n-1, k-2) * n*(n-1)/k = number of permutations of [n] with k elements not fixed by the permutation. - Michael Somos, Aug 19 2018

Examples

			Triangle starts:
  1;
  1, 1;
  1, 2,   3;
  1, 3,   9,  11;
  1, 4,  18,  44,   53;
  1, 5,  30, 110,  265,   309;
  1, 6,  45, 220,  795,  1854,   2119;
  1, 7,  63, 385, 1855,  6489,  14833,  16687;
  1, 8,  84, 616, 3710, 17304,  59332, 133496,  148329;
  1, 9, 108, 924, 6678, 38934, 177996, 600732, 1334961, 1468457;
  ...
For n=3, the permutations 123, 132, 213, 231, 312, 321 have respectively 2,0,0,1,1,0 consecutive ascending pairs, so row 3 of the triangle is 3,2,1. - _N. J. A. Sloane_, Apr 12 2014
In the alternative definition, T(4,2)=3 because we have 234.1, 4.123, and 34.12 (the blocks are separated by dots). - _Emeric Deutsch_, May 16 2010
		

References

  • F. N. David, M. G. Kendall and D. E. Barton, Symmetric Function and Allied Tables, Cambridge, 1966, p. 263.

Crossrefs

Diagonals, reading from the right-hand edge: A000255, A000166, A000274, A000313, A001260, A001261. A045943 is another diagonal.
Cf. A123513 (mirror image).
A289632 is the analogous triangle with the additional restriction that all consecutive pairs must be isolated, i.e., must not be back-to-back to form longer consecutive sequences.

Programs

  • Maple
    U := proc (n, k) options operator, arrow: factorial(k+1)*binomial(n, k)*(sum((-1)^i/factorial(i), i = 0 .. k+1))/n end proc: for n to 10 do seq(U(n, k), k = 1 .. n) end do; # yields sequence in triangular form; # Emeric Deutsch, May 15 2010
  • Mathematica
    t[n_, k_] := Binomial[n, k]*Subfactorial[k+1]/n; Table[t[n, k], {n, 1, 12}, {k, 1, n}] // Flatten (* Jean-François Alcover, Jan 07 2014, after Emeric Deutsch *)
    T[0,0]:=0; T[1,1]:=1; T[n_,n_]:=T[n,n]=(n-1)T[n-1,n-1]+(n-2)T[n-2,n-2]; T[n_,k_]:=T[n,k]=T[n-1,k] (n-1)/(n-k); Flatten@Table[T[n,k],{n,1,10},{k,1,n}] (* Oliver Seipel, Dec 01 2024 *)

Formula

E.g.f.: exp(x*(y-1))/(1-x)^2. - Vladeta Jovovic, Jan 03 2003
From Emeric Deutsch, May 15 2010: (Start)
U(n,k) = binomial(n-1,k-1)*(k-1)!*Sum_{j=0..k-1} (-1)^(k-j-1)*(j+1)/(k-j-1)! (1 <= k <= n).
U(n,k) = (k+1)!*binomial(n,k)*(1/n)*Sum_{i=0..k+1} (-1)^i/i!.
U(n,k) = (1/n)*binomial(n,k)*d(k+1), where d(j)=A000166(j) (derangement numbers). (End)

Extensions

More terms from Vladeta Jovovic, Jan 03 2003
Original definition from David, Kendall and Barton restored by N. J. A. Sloane, Apr 12 2014

A046739 Triangle read by rows, related to number of permutations of [n] with 0 successions and k rises.

Original entry on oeis.org

0, 1, 1, 1, 1, 7, 1, 1, 21, 21, 1, 1, 51, 161, 51, 1, 1, 113, 813, 813, 113, 1, 1, 239, 3361, 7631, 3361, 239, 1, 1, 493, 12421, 53833, 53833, 12421, 493, 1, 1, 1003, 42865, 320107, 607009, 320107, 42865, 1003, 1, 1, 2025, 141549, 1704693, 5494017
Offset: 1

Views

Author

Keywords

Comments

From Emeric Deutsch, May 25 2009: (Start)
T(n,k) is the number of derangements of [n] having k excedances. Example: T(4,2)=7 because we have 3*14*2, 3*4*12, 4*3*12, 2*14*3, 2*4*13, 3*4*21, 4*3*21, each with two excedances (marked). An excedance of a permutation p is a position i such that p(i) > i.
Sum_{k>=1} k*T(n,k) = A000274(n+1). (End)
The triangle 1;1,1;1,7,1;... has general term T(n,k) = Sum_{j=0..n+2} (-1)^(n-j)*C(n+2,j)*A123125(j,k+2) and bivariate g.f. ((1-y)*(y*exp(2*x*y) + exp(x*(y+1))(y^2 - 4*y + 1) + y*exp(2*x)))/(exp(x*y) - y*exp(x))^3. - Paul Barry, May 10 2011
The n-th row is the local h-vector of the barycentric subdivision of a simplex, i.e., the Coxeter complex of type A. See Proposition 2.4 of Stanley's paper below. - Kyle Petersen, Aug 20 2012
T(n,k) is the k-th coefficient of the local h^*-polynomial, or box polynomial, of the s-lecture hall n-simplex with s=(2,3,...,n+1). See Theorem 4.1 of the paper by N. Gustafsson and L. Solus below. - Liam Solus, Aug 23 2018

Examples

			Triangle starts:
  0;
  1;
  1,   1;
  1,   7,   1;
  1,  21,  21,   1;
  1,  51, 161,  51,   1;
  1, 113, 813, 813, 113, 1;
  ...
From _Peter Luschny_, Sep 17 2021: (Start)
The triangle shows the coefficients of the following bivariate polynomials:
  [1] 0;
  [2] x*y;
  [3] x^2*y +     x*y^2;
  [4] x^3*y +   7*x^2*y^2 +     x*y^3;
  [5] x^4*y +  21*x^3*y^2 +  21*x^2*y^3 +     x*y^4;
  [6] x^5*y +  51*x^4*y^2 + 161*x^3*y^3 +  51*x^2*y^4 +     x*y^5;
  [7] x^6*y + 113*x^5*y^2 + 813*x^4*y^3 + 813*x^3*y^4 + 113*x^2*y^5 + x*y^6;
  ...
These polynomials are the permanents of the n X n matrices with all entries above the main antidiagonal set to 'x' and all entries below the main antidiagonal set to 'y'. The main antidiagonals consist only of zeros. Substituting x <- 1 and y <- -1 generates the Euler secant numbers A122045. (Compare with A081658.)
(End)
		

Crossrefs

Cf. A046740.
Row sums give A000166.
Diagonals give A070313, A070315.
T(2n,n) gives A320337.

Programs

  • Maple
    G := (1-t)*exp(-t*z)/(1-t*exp((1-t)*z)): Gser := simplify(series(G, z = 0, 15)): for n to 13 do P[n] := sort(expand(factorial(n)*coeff(Gser, z, n))) end do: 0; for n to 11 do seq(coeff(P[n], t, j), j = 1 .. n-1) end do; # yields sequence in triangular form # Emeric Deutsch, May 25 2009
  • Mathematica
    max = 12; f[t_, z_] := (1-t)*(Exp[-t*z]/(1 - t*Exp[(1-t)*z])); se = Series[f[t, z], {t, 0, max}, {z, 0, max}];
    coes = Transpose[ #*Range[0, max]! & /@ CoefficientList[se, {t, z}]]; Join[{0}, Flatten[ Table[ coes[[n, k]], {n, 2, max}, {k, 2, n-1}]]] (* Jean-François Alcover, Oct 24 2011, after g.f. *)
    E1[n_ /; n >= 0, 0] = 1; (* E1(n,k) are the Eulerian numbers *)
    E1[n_, k_] /; k < 0 || k > n = 0;
    E1[n_, k_] := E1[n, k] = (n-k) E1[n-1, k-1] + (k+1) E1[n-1, k];
    T[n_, k_] := Sum[Binomial[-j-1, -n-1] E1[j, k], {j, 0, n}];
    Table[T[n, k], {n, 1, 100}, {k, 1, n-1}] /. {} -> {0} // Flatten (* Jean-François Alcover, Oct 31 2020, after Peter Luschny in A271697 *)
    Table[Expand[n!Factor[SeriesCoefficient[(x-y)/(x Exp[y t]-y Exp[x t]),{t,0,n}]]],{n,0,12}]//TableForm (* Mamuka Jibladze, Nov 26 2024 *)
  • PARI
    T(n)={my(x='x+O('x^(n+1))); concat([[0]], [Vecrev(p/y) | p<-Vec(-1+serlaplace((y-1)/(y*exp(x)-exp(x*y))))])}
    { my(A=T(10));for(i=1,#A,print(A[i])) } \\ Andrew Howroyd, Nov 13 2024

Formula

a(n+1, r) = r*a(n, r) + (n+1-r)*a(n, r-1) + n*a(n-1, r-1).
exp(-t)/(1 - exp((x-1)t)/(x-1)) = 1 + x*t^2/2! + (x+x^2)*t^3/3! + (x+7x^2+x^3)*t^4/4! + (x+21x^2+21x^3+x^4)*t^5/5! + ... - Philippe Deléham, Jun 11 2004
E.g.f.: (y-1)/(y*exp(x) - exp(x*y)). - Mamuka Jibladze, Nov 08 2024

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Apr 07 2000

A123513 Triangle read by rows: T(n,k) is the number of permutations of [n] having k small descents (n >= 1; 0 <= k <= n-1). A small descent in a permutation (x_1,x_2,...,x_n) is a position i such that x_i - x_(i+1) = 1.

Original entry on oeis.org

1, 1, 1, 3, 2, 1, 11, 9, 3, 1, 53, 44, 18, 4, 1, 309, 265, 110, 30, 5, 1, 2119, 1854, 795, 220, 45, 6, 1, 16687, 14833, 6489, 1855, 385, 63, 7, 1, 148329, 133496, 59332, 17304, 3710, 616, 84, 8, 1, 1468457, 1334961, 600732, 177996, 38934, 6678, 924, 108, 9, 1
Offset: 1

Views

Author

Emeric Deutsch, Oct 02 2006

Keywords

Comments

This triangle is essentially A010027 (ascending pairs in permutations of [n]) with a different offset. The same triangle gives the number of permutations of [n] having k unit ascents (n >= 1; 0 <= k <= n-1). For permutations sorted by number of non-unitary (i.e., > 1) descents (also called "big" descents), see A120434. For permutations sorted by number of unitary moves (i.e., ascent or descent), see A001100. - Olivier Gérard, Oct 09 2007
With offsets n=0 (k=0) this is a binomial convolution triangle, a Sheffer triangle of the Appell type: ((exp(-x))/(1-x)^2),x). See the e.g.f. given below.

Examples

			Triangle starts:
     1;
     1,    1;
     3,    2,   1;
    11,    9,   3,   1;
    53,   44,  18,   4,  1;
   309,  265, 110,  30,  5, 1;
  2119, 1854, 795, 220, 45, 6, 1;
  ...
T(4,2)=3 because we have 14/3/2, 2/14/3 and 3/2/14 (the unit descents are shown by a /).
T(4,2)=3 because we have 14/3/2, 2/14/3 and 3/2/14 (the small descents are shown by a /).
		

References

  • Ch. A. Charalambides, Enumerative Combinatorics, Chapman & Hall/CRC, Boca Raton, Florida, 2002, p. 179, Table 5.4 for S_{n,k} (without row n=1 and column k=0).
  • F. N. David, M. G. Kendall and D. E. Barton, Symmetric Function and Allied Tables, Cambridge, 1966, p. 263 (Table 7.5.1).

Crossrefs

Cf. A010027 (mirror image), A120434, A001100.

Programs

  • Maple
    G:=exp(-x+t*x)/(1-x)^2: Gser:=simplify(series(G,x=0,15)): for n from 0 to 10 do P[n+1]:=sort(n!*coeff(Gser,x,n)) od: for n from 1 to 11 do seq(coeff(P[n],t,k),k=0..n-1) od; # yields sequence in triangular form
  • Mathematica
    Needs["Combinatorica`"];
    Table[Map[Count[#,1]&,Map[Differences,Permutations[n]]]//Distribution,{n,1,10}]//Grid
    (* Geoffrey Critzer, Dec 15 2012 *)
    T[n_, k_] := (n-1)! SeriesCoefficient[Exp[-x + t x]/(1-x)^2, {x, 0, n-1}, {t, 0, k}];
    Table[T[n, k], {n, 1, 10}, {k, 0, n-1}] // Flatten (* Jean-François Alcover, Sep 25 2019 *)
    T[1,1]:=1;T[0,1]:=0;T[n_,1]:=T[n,1]=(n-1)T[n-1,1]+(n-2)T[n-2,1];T[n_,k_]:=T[n,k]=T[n-1, k-1](n-1)/(k-1);Flatten@Table[T[n,k],{n,1,10},{k,1,n}] (* Oliver Seipel, Dec 01 2024 *)

Formula

T(n,1) = A000255(n-1).
T(n,2) = A000166(n-1) (the derangement numbers).
T(n,3) = A000274(n).
T(n,4) = A000313(n).
T(n,5) = A001260(n);
G.f.: exp(-x+tx)/(1-x)^2 (if offset is 0), i.e., T(n,k)=(n-1)!*[x^(n-1) t^k]exp(-x+tx)/(1-x)^2.
T(n,k) = binomial(n-1,k)*A000255(n-1), n-1 >= k >= 0, else 0.

A000313 Number of permutations of length n with 3 consecutive ascending pairs.

Original entry on oeis.org

0, 0, 0, 1, 4, 30, 220, 1855, 17304, 177996, 2002440, 24474285, 323060540, 4581585866, 69487385604, 1122488536715, 19242660629360, 348933579412440, 6673354706262864, 134252194678935321, 2834212998777523380, 62651024183503148470, 1447238658638922729580
Offset: 1

Views

Author

Keywords

Comments

Temporary remark: there may be some issues with respect to the offset of this sequence in the formula and program sections. - Joerg Arndt, Nov 16 2014

References

  • F. N. David, M. G. Kendall and D. E. Barton, Symmetric Function and Allied Tables, Cambridge, 1966, p. 263.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

A diagonal in triangle A010027.

Programs

  • Maple
    series(hypergeom([2,4],[],x/(x+1))/(x+1)^4, x=0, 30); # Mark van Hoeij, Nov 07 2011
    a := n -> simplify(hypergeom([4-n,2],[],1))*(-1)^n*(n-1)*(n-2)*(n-3)/6: seq(a(n), n=1..23); # Peter Luschny, Nov 19 2014
  • Mathematica
    Table[(n*(n + 1)!/6)*Sum[(-1)^k/k!, {k, 0, n}], {n, -1, 25}] (* T. D. Noe, Jun 19 2012 *)
    a[1]:=0; a[n_Integer/;n>=2]:=(n-2) (n-1) Subfactorial[n-2]/6 (* Todd Silvestri, Nov 15 2014 *)
  • Sage
    a = lambda n: (n-2)*(n-1)*sloane.A000166(n-2)/6 if n>2 else 0
    [a(n) for n in range(1,24)] # Peter Luschny, Nov 19 2014

Formula

a(n) = (n*(n+1)!/6)*sum((-1)^k/k!, k=0..n).
a(n) = A065087(n+2)/3. - Zerinvary Lajos, May 25 2007
E.g.f.: x^3/3!*exp(-x)/(1-x)^2. - Vladeta Jovovic, Jan 03 2003
a(n) = round( (exp(-1)*(n+1)!+(-1)^n)*n/6 ). - Mark van Hoeij, Oct 25 2011
G.f.: hypergeom([2, 4],[],x/(x+1))/(x+1)^4. - Mark van Hoeij, Nov 07 2011
a(1) = 0, a(n) = (n-2)*(n-1)*(!(n-2))/6 = (n-2)*(n-1)*A000166(n-2)/6, for n >= 2. - Todd Silvestri, Nov 15 2014
a(n) = hypergeom([4-n,2],[],1)*(-1)^n*A000292(n-3). - Peter Luschny, Nov 19 2014
D-finite with recurrence (-n+4)*a(n) +(n-1)*(n-4)*a(n-1) +(n-1)*(n-2)*a(n-2)=0. - R. J. Mathar, Aug 01 2022

Extensions

More terms from Vladeta Jovovic, Jan 03 2003
Formula added by Sean A. Irvine, Nov 11 2010
Name clarified and offset changed by N. J. A. Sloane, Apr 12 2014

A001260 Number of permutations of length n with 4 consecutive ascending pairs.

Original entry on oeis.org

0, 0, 0, 0, 1, 5, 45, 385, 3710, 38934, 444990, 5506710, 73422855, 1049946755, 16035550531, 260577696015, 4489954146860, 81781307674780, 1570201107355980, 31698434854748604, 671260973394676605, 14879618243581997745
Offset: 1

Views

Author

Keywords

References

  • F. N. David, M. G. Kendall and D. E. Barton, Symmetric Function and Allied Tables, Cambridge, 1966, p. 263.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

A diagonal in triangle A010027.

Programs

  • Maple
    a:=n->sum((n+2)!*sum((-1)^k/k!/4!, j=1..n), k=0..n): seq(a(n), n=2..19); # Zerinvary Lajos, May 25 2007
    series(hypergeom([2, 5],[],x/(x+1))/(x+1)^5,x=0,30); # Mark van Hoeij, Nov 07 2011
  • Mathematica
    Drop[CoefficientList[Series[x^4/4! Exp[-x]/(1 - x)^2, {x, 0, 20}], x] Range[0, 20]!, 4] (* Vaclav Kotesovec, Mar 26 2014 *)

Formula

(n-1)*a(n) = (n+3)*(a(n-1)*n + a(n-2)*n - a(n-1) + 2*a(n-2)).
E.g.f.: (for offset 4): (x^4/4!)*exp(-x)/(1-x)^2. - Vladeta Jovovic, Jan 03 2003
G.f.: (for offset 0): hypergeom([2, 5],[],x/(x+1))/(x+1)^5. - Mark van Hoeij, Nov 07 2011
Recurrence (for offset 5): (n-5)*a(n) = (n-5)*(n-1)*a(n-1) + (n-2)*(n-1)*a(n-2). - Vaclav Kotesovec, Mar 26 2014
a(n) ~ n! * exp(-1)/24. - Vaclav Kotesovec, Mar 26 2014

Extensions

More terms from Vladeta Jovovic, Jan 03 2003
Name clarified and offset changed by N. J. A. Sloane, Apr 12 2014

A001261 Number of permutations of length n with 5 consecutive ascending pairs.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 6, 63, 616, 6678, 77868, 978978, 13216104, 190899423, 2939850914, 48106651593, 833848627248, 15265844099324, 294412707629208, 5966764207952724, 126793739418994416, 2819296088257641741, 65470320271760790078
Offset: 1

Views

Author

Keywords

References

  • F. N. David, M. G. Kendall and D. E. Barton, Symmetric Function and Allied Tables, Cambridge, 1966, p. 263.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

A diagonal in triangle A010027.

Programs

  • Maple
    a:=n->sum((n+3)!*sum((-1)^k/k!/5!, j=1..n), k=0..n): seq(a(n), n=2..19); # Zerinvary Lajos, May 25 2007
  • Mathematica
    Range[0, 30]! CoefficientList[Series[x^5/5!*Exp[-x]/(1 - x)^2, {x, 0, 40}], x] (* Vincenzo Librandi, Apr 13 2014 *)

Formula

E.g.f.: (x^5/5!)*exp(-x)/(1-x)^2. - Vladeta Jovovic, Jan 03 2003

Extensions

More terms from Vladeta Jovovic, Jan 03 2003
Name clarified and offset changed by N. J. A. Sloane, Apr 12 2014

A086325 Let u(1)=0, u(2)=1, u(k)=u(k-1)+u(k-2)/(k-2); then a(n)=n!*u(n).

Original entry on oeis.org

0, 2, 6, 36, 220, 1590, 12978, 118664, 1201464, 13349610, 161530270, 2114578092, 29780308116, 448995414686, 7215997736010, 123153028027920, 2224451568754288, 42395429898611154, 850263899633257014, 17900292623858042420, 394701452356069835340, 9096928711444657157382, 218739785834282892557026
Offset: 1

Views

Author

N. J. A. Sloane. This sequence appeared in the 1973 "Handbook", but was then omitted from the database. Resubmitted by Benoit Cloitre, Aug 30 2003. Entry revised by N. J. A. Sloane, Jun 11 2012

Keywords

References

  • F. N. David, M. G. Kendall and D. E. Barton, Symmetric Function and Allied Tables, Cambridge, 1966, p. 263, Table 7.5.1, row 3.
  • J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p. 210, Table 3, Three-line Latin rectangles.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).

Crossrefs

Programs

  • Maple
    a:=n->n!*add((-1)^k/k!, k=0..n): seq(a(n)*n, n=1..19); # Zerinvary Lajos, Dec 18 2007
    with (combstruct):with (combinat):a:=proc(m) [ZL, {ZL=Set(Cycle(Z, card>=m))}, labeled]; end: ZLL:=a(2):seq(count(ZLL, size=n)*fibonacci(2,n), n=1..19); # Zerinvary Lajos, Jun 11 2008
    with (combstruct):a:=proc(m) [ZL, {ZL=Set(Cycle(Z, card>=m))}, labeled]; end: ZLL:=a(2):seq(count(ZLL, size=n)*n, n=1..19); # Zerinvary Lajos, Jun 11 2008
  • Mathematica
    Table[Subfactorial[n]*n, {n, 1, 19}] (* Zerinvary Lajos, Jul 09 2009 *)
  • PARI
    a(n) = n*((n! + 1)\exp(1)); \\ Indranil Ghosh, Apr 13 2017

Formula

a(n) = ceiling(n*n!/e) - (1-(-1)^n)/2.
E.g.f.: x^2*exp(-x)/(1-x)^2. - Vladeta Jovovic, Nov 20 2003
a(n) = n*floor((n!+1)/e). [Gary Detlefs, Jul 13 2010]
a(n) = n * A000166(n). [Joerg Arndt, Jul 09 2012]
G.f.: x*f'(x), where f(x) = 1/(1 + x) + Sum_{k>=1} k^k*x^k/(1 + (k + 1)*x)^(k+1). - Ilya Gutkovskiy, Apr 13 2017

A345462 Triangle T(n,k) (n >= 1, 0 <= k <= n-1) read by rows: number of distinct permutations after k steps of the "first transposition" algorithm.

Original entry on oeis.org

1, 2, 1, 6, 3, 1, 24, 13, 4, 1, 120, 67, 23, 5, 1, 720, 411, 146, 36, 6, 1, 5040, 2921, 1067, 272, 52, 7, 1, 40320, 23633, 8800, 2311, 456, 71, 8, 1, 362880, 214551, 81055, 21723, 4419, 709, 93, 9, 1, 3628800, 2160343, 825382, 224650, 46654, 7720, 1042, 118, 10, 1
Offset: 1

Views

Author

Olivier Gérard, Jun 20 2021

Keywords

Comments

The first transposition algorithm is: if the permutation is sorted, then exit; otherwise, exchange the first unsorted letter with the letter currently at its index. Repeat.
At each step at least 1 letter (possibly 2) is sorted.
If one counts the steps necessary to reach the identity, this gives the Stirling numbers of the first kind (reversed).

Examples

			Triangle begins:
      1;
      2,     1;
      6,     3,    1;
     24,    13,    4,    1;
    120,    67,   23,    5,   1;
    720,   411,  146,   36,   6,  1;
   5040,  2921, 1067,  272,  52,  7, 1;
  40320, 23633, 8800, 2311, 456, 71, 8, 1;
  ...
		

References

  • D. E. Knuth, The Art of Computer Programming, Vol. 3 / Sorting and Searching, Addison-Wesley, 1973.

Crossrefs

Cf. A321352, A345461 (same idea for other sorting algorithms).
Cf. A180191 (second column, k=1).
Cf. A107111 a triangle with some common parts.
Cf. A143689 (diagonal T(n,n-3)).

Programs

  • Maple
    b:= proc(n, k) option remember; (k+1)!*
          binomial(n, k)*add((-1)^i/i!, i=0..k+1)/n
        end:
    T:= proc(n, k) option remember;
         `if`(k=0, n!, T(n, k-1)-b(n, n-k+1))
        end:
    seq(seq(T(n, k), k=0..n-1), n=1..10);  # Alois P. Heinz, Aug 11 2021
  • Mathematica
    b[n_, k_] := b[n, k] = (k+1)!*Binomial[n, k]*Sum[(-1)^i/i!, {i, 0, k+1}]/n;
    T[n_, k_] := T[n, k] = If[k == 0, n!, T[n, k-1] - b[n, n-k+1]];
    Table[Table[T[n, k], {k, 0, n - 1}], {n, 1, 10}] // Flatten (* Jean-François Alcover, Mar 06 2022, after Alois P. Heinz *)

Formula

T(n,0) = n!; T(n,n-3) = (3*(n-1)^2 - n + 3)/2.
From Alois P. Heinz, Aug 11 2021: (Start)
T(n,k) = T(n,k-1) - A010027(n,n-k) for k >= 1.
T(n,k) - T(n,k+1) = A123513(n,k).
T(n,0) - T(n,1) = A000255(n-1) for n >= 2.
T(n,1) - T(n,2) = A000166(n) for n >= 3.
T(n,2) - T(n,3) = A000274(n) for n >= 4.
T(n,3) - T(n,4) = A000313(n) for n >= 5. (End)

A271706 Triangle read by rows: T(n, k) = Sum_{j=0..n} C(-j-1, -n-1)*L(j, k), L the unsigned Lah numbers A271703, for n >= 0 and 0 <= k <= n.

Original entry on oeis.org

1, -1, 1, 1, 0, 1, -1, 3, 3, 1, 1, 8, 18, 8, 1, -1, 45, 110, 70, 15, 1, 1, 264, 795, 640, 195, 24, 1, -1, 1855, 6489, 6335, 2485, 441, 35, 1, 1, 14832, 59332, 67984, 32550, 7504, 868, 48, 1, -1, 133497, 600732, 789852, 445914, 126126, 19068, 1548, 63, 1
Offset: 0

Views

Author

Peter Luschny, Apr 20 2016

Keywords

Examples

			Triangle starts:
  [ 1]
  [-1,    1]
  [ 1,    0,    1]
  [-1,    3,    3,    1]
  [ 1,    8,   18,    8,    1]
  [-1,   45,  110,   70,   15,   1]
  [ 1,  264,  795,  640,  195,  24,  1]
  [-1, 1855, 6489, 6335, 2485, 441, 35, 1]
		

Crossrefs

A052845 (row sums), A000240 (col. 1), A000274 (col. 2), A067998 (diag n,n-1).

Programs

  • Maple
    L := (n, k) -> `if`(k<0 or k>n, 0, (n-k)!*binomial(n, n-k)*binomial(n-1, n-k)):
    T := (n, k) -> add(L(j, k)*binomial(-j-1,-n-1), j=0..n):
    seq(seq(T(n, k), k=0..n), n=0..9);
    # Or:
    T := (n, k) -> (-1)^(n-k)*binomial(n, k)*hypergeom([k-n, k], [], 1):
    for n from 0 to 8 do seq(simplify(T(n, k)), k=0..n) od; # Peter Luschny, Jun 25 2025

Formula

T(n, k) = (-1)^(k-n)*binomial(n, k)*hypergeom([k-n, k], [], 1). (After a formula of Natalia L. Skirrow in A271705.) - Peter Luschny, Jun 25 2025
Showing 1-9 of 9 results.