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-10 of 20 results. Next

A002720 Number of partial permutations of an n-set; number of n X n binary matrices with at most one 1 in each row and column.

Original entry on oeis.org

1, 2, 7, 34, 209, 1546, 13327, 130922, 1441729, 17572114, 234662231, 3405357682, 53334454417, 896324308634, 16083557845279, 306827170866106, 6199668952527617, 132240988644215842, 2968971263911288999, 69974827707903049154, 1727194482044146637521, 44552237162692939114282
Offset: 0

Views

Author

Keywords

Comments

a(n) is also the total number of increasing subsequences of all permutations of [1..n] (see Lifschitz and Pittel). - N. J. A. Sloane, May 06 2012
a(n) = A000142 + A001563 + A001809 + A001810 + A001811 + A001812 + ... these sequences respectively give the number of increasing subsequences of length i for i=0,1,2,... in all permutations of [1..n]. - Geoffrey Critzer, Jan 17 2013
a(n) is also the number of matchings in the complete bipartite graph K(n,n). - Sharon Sela (sharonsela(AT)hotmail.com), May 19 2002
a(n) is also the number of 12-avoiding signed permutations in B_n (see Simion ref).
a(n) is also the order of the symmetric inverse semigroup (monoid) I_n. - A. Umar, Sep 09 2008
EXP transform of A001048(n) = n! + (n-1)!. - Franklin T. Adams-Watters, Dec 28 2006
From Peter Luschny, Mar 27 2011: (Start)
Let B_{n}(x) = Sum_{j>=0} exp(j!/(j-n)!*x-1)/j!; then a(n) = 2! [x^2] Taylor(B_{n}(x)), where [x^2] denotes the coefficient of x^2 in the Taylor series for B_{n}(x).
a(n) is column 2 of the square array representation of A090210. (End)
a(n) is the Hosoya index of the complete bipartite graph K_{n,n}. - Eric W. Weisstein, Jul 09 2011
a(n) is also number of non-attacking placements of k rooks on an n X n board, summed over all k >= 0. - Vaclav Kotesovec, Aug 28 2012
Also the number of vertex covers and independent vertex sets in the n X n rook graph. - Eric W. Weisstein, Jan 04 2013
a(n) is the number of injective functions from subsets of [n] to [n] where [n]={1,2,...,n}. For a subset D of size k, there are n!/(n-k)! injective functions from D to [n]. Summing over all subsets, we obtain a(n) = Sum_{k=0..n} C(n,k)*n!/(n-k)! = Sum_{k=0..n} k!*C(n,k)^2. - Dennis P. Walsh, Nov 16 2015
Also the number of cliques in the n X n rook complement graph. - Eric W. Weisstein, Sep 14 2017
a(n)/n! is the expected value of the n-th term of Ulam's "history-dependent random sequence". See Kac (1989), Eq.(2). - N. J. A. Sloane, Nov 16 2019
a(2*n) is odd and a(2*n+1) is even for all n. More generally, for each positive integer k, a(n+k) == a(n) (mod k) for all n. It follows that for each positive integer k, the sequence obtained by reducing a(n) modulo k is periodic, with period dividing k. Various divisibility properties of the sequence follow from this: for example, a(7*n+2) == 0 (mod 7), a(11*n+4) == 0 (mod 11), a(17*n+3) == 0 (mod 17) and a(19*n+4) == 0 (mod 19). - Peter Bala, Nov 07 2022
Conjecture: a(n)*k is the sum of the largest parts in all integer partitions containing their own first differences with n + 1 parts and least part k. - John Tyler Rascoe, Feb 28 2024

Examples

			G.f. = 1 + 2*x + 7*x^2 + 34*x^3 + 209*x^4 + 1546*x^5 + 13327*x^6 + 130922*x^7 + ... - _Michael Somos_, Jul 31 2018
		

References

  • J. M. Howie, Fundamentals of semigroup theory. Oxford: Clarendon Press, (1995). [From A. Umar, Sep 09 2008]
  • J. Ser, Les Calculs Formels des Séries de Factorielles. Gauthier-Villars, Paris, 1933, p. 78.
  • 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).
  • H. S. Wall, Analytic Theory of Continued Fractions, Chelsea 1973, p. 356.

Crossrefs

Main diagonal of A088699. Column of A283500. Row sums of A144084.
Column k=1 of A289192.
Cf. A364673.

Programs

  • Magma
    [Factorial(n)*Evaluate(LaguerrePolynomial(n), -1): n in [0..25]]; // G. C. Greubel, Aug 11 2022
    
  • Maple
    A002720 := proc(n) exp(-x)*n!*hypergeom([n+1], [1], x); simplify(subs(x=1, %)) end: seq(A002720(n), n=0..25); # Peter Luschny, Mar 30 2011
    A002720 := proc(n)
        option remember;
        if n <= 1 then
            n+1 ;
        else
            2*n*procname(n-1)-(n-1)^2*procname(n-2) ;
        end if;
    end proc: # R. J. Mathar, Mar 09 2017
  • Mathematica
    Table[n! LaguerreL[n, -1], {n, 0, 25}]
    Table[(-1)^n*HypergeometricU[-n, 1, -1], {n, 0, 25}] (* Jean-François Alcover, Jul 15 2015 *)
    RecurrenceTable[{(n+1)^2 a[n] - 2(n+2) a[n+1] + a[n+2]==0, a[1]==2, a[2]==7}, a, {n, 25}] (* Eric W. Weisstein, Sep 27 2017 *)
  • PARI
    a(n) = sum(k=0, n, k!*binomial(n, k)^2 );
    
  • PARI
    a(n) = suminf ( k=0, binomial(n+k,n)/k! ) / ( exp(1)/n! ) /* Gottfried Helms, Nov 25 2006 */
    
  • PARI
    {a(n)=n!^2*polcoeff(exp(x+x*O(x^n))*sum(m=0,n,x^m/m!^2),n)} /* Paul D. Hanna, Nov 18 2011 */
    
  • PARI
    {a(n)=if(n==0,1,polcoeff(1-sum(m=0, n-1, a(m)*x^m*(1-(m+1)*x+x*O(x^n))^2), n))} /* Paul D. Hanna, Nov 27 2012 */
    
  • PARI
    my(x='x+O('x^22)); Vec(serlaplace((1/(1-x))*exp(x/(1-x)))) \\ Joerg Arndt, Aug 11 2022
    
  • Python
    from math import factorial, comb
    def A002720(n): return sum(factorial(k)*comb(n,k)**2 for k in range(n+1)) # Chai Wah Wu, Aug 31 2023
  • SageMath
    [factorial(n)*laguerre(n, -1) for n in (0..25)] # G. C. Greubel, Aug 11 2022
    

Formula

a(n) = Sum_{k=0..n} k!*C(n, k)^2.
E.g.f.: (1/(1-x))*exp(x/(1-x)). - Don Knuth, Jul 1995
D-finite with recurrence: a(n) = 2*n*a(n-1) - (n-1)^2*a(n-2).
a(n) = Sum_{k>=0} (k+n)! / ((k!)^2*exp(1)). - Robert G. Wilson v, May 02 2002 [corrected by Vaclav Kotesovec, Aug 28 2012]
a(n) = Sum_{m>=0} (-1)^m*A021009(n, m). - Philippe Deléham, Mar 10 2004
a(n) = Sum_{k=0..n} C(n, k)n!/k!. - Paul Barry, May 07 2004
a(n) = Sum_{k=0..n} P(n, k)*C(n, k); a(n) = Sum_{k=0..n} n!^2/(k!*(n-k)!^2). - Ross La Haye, Sep 20 2004
a(n) = Sum_{k=0..n} (-1)^(n-k)*Stirling1(n, k)*Bell(k+1). - Vladeta Jovovic, Mar 18 2005
Define b(n) by b(0) = 1, b(n) = b(n-1) + (1/n) * Sum_{k=0..n-1} b(k). Then b(n) = a(n)/n!. - Franklin T. Adams-Watters, Sep 05 2005
Asymptotically, a(n)/n! ~ (1/2)*Pi^(-1/2)*exp(-1/2 + 2*n^(1/2))/n^(1/4) and so a(n) ~ C*BesselI(0, 2*sqrt(n))*n! with C = exp(-1/2) = 0.6065306597126334236... - Alec Mihailovs, Sep 06 2005, establishing a conjecture of Franklin T. Adams-Watters
a(n) = (n!/e) * Sum_{k>=0} binomial(n+k,n)/k!. - Gottfried Helms, Nov 25 2006
Integral representation as n-th moment of a positive function on a positive halfaxis (solution of the Stieltjes moment problem): a(n) = Integral_{x=0..oo} x^n*BesselI(0,2*sqrt(x))*exp(-x)/exp(1) dx, n >= 0. - Karol A. Penson and G. H. E. Duchamp (gduchamp2(AT)free.fr), Jan 09 2007
a(n) = n! * LaguerreL[n, -1].
E.g.f.: exp(x) * Sum_{n>=0} x^n/n!^2 = Sum_{n>=0} a(n)*x^n/n!^2. - Paul D. Hanna, Nov 18 2011
From Peter Bala, Oct 11 2012: (Start)
Denominators in the sequence of convergents coming from Stieltjes's continued fraction for A073003, the Euler-Gompertz constant G := Integral_{x = 0..oo} 1/(1+x)*exp(-x) dx:
G = 1/(2 - 1^2/(4 - 2^2/(6 - 3^2/(8 - ...)))). See [Wall, Chapter 18, (92.7) with a = 1]. The sequence of convergents to the continued fraction begins [1/2, 4/7, 20/34, 124/209, ...]. The numerators are in A002793. (End)
G.f.: 1 = Sum_{n>=0} a(n) * x^n * (1 - (n+1)*x)^2. - Paul D. Hanna, Nov 27 2012
E.g.f.: exp(x/(1-x))/(1-x) = G(0)/(1-x) where G(k) = 1 + x/((2*k+1)*(1-x) - x*(1-x)*(2*k+1)/(x + (1-x)*(2*k+2)/G(k+1))); (continued fraction). - Sergei N. Gladkovskii, Dec 28 2012
a(n) = Sum_{k=0..n} L(n,k)*(k+1); L(n,k) the unsigned Lah numbers. - Peter Luschny, Oct 18 2014
a(n) = n! * A160617(n)/A160618(n). - Alois P. Heinz, Jun 28 2017
0 = a(n)*(-24*a(n+2) +99*a(n+3) -78*a(n+4) +17*a(n+5) -a(n+6)) +a(n+1)*(-15*a(n+2) +84*a(n+3) -51*a(n+4) +6*a(n+5)) +a(n+2)*(-6*a(n+2) +34*a(n+3) -15*a(n+4)) +a(n+3)*(+10*a(n+3)) for all n>=0. - Michael Somos, Jul 31 2018
a(n) = Sum_{k=0..n} C(n,k)*k!*A000262(n-k). - Geoffrey Critzer, Jan 07 2023
a(n) = A000262(n+1) - n * A000262(n). - Werner Schulte, Mar 29 2024
a(n) = denominator of (1 + n/(1 + n/(1 + (n-1)/(1 + (n-1)/(1 + ... + 1/(1 + 1/(1))))))). See A000262 for the numerators. - Peter Bala, Feb 11 2025

Extensions

2nd description from R. H. Hardin, Nov 1997
3rd description from Wouter Meeussen, Jun 01 1998

A008302 Triangle of Mahonian numbers T(n,k): coefficients in expansion of Product_{i=0..n-1} (1 + x + ... + x^i), where k ranges from 0 to A000217(n-1). Also enumerates permutations by their major index.

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 1, 1, 3, 5, 6, 5, 3, 1, 1, 4, 9, 15, 20, 22, 20, 15, 9, 4, 1, 1, 5, 14, 29, 49, 71, 90, 101, 101, 90, 71, 49, 29, 14, 5, 1, 1, 6, 20, 49, 98, 169, 259, 359, 455, 531, 573, 573, 531, 455, 359, 259, 169, 98, 49, 20, 6, 1, 1, 7, 27, 76, 174, 343, 602, 961, 1415, 1940, 2493, 3017, 3450, 3736, 3836, 3736, 3450, 3017, 2493, 1940, 1415, 961, 602, 343, 174, 76, 27, 7, 1, 1, 8, 35, 111, 285, 628, 1230, 2191, 3606, 5545, 8031, 11021, 14395, 17957, 21450, 24584, 27073, 28675, 29228, 28675, 27073, 24584, 21450, 17957, 14395, 11021, 8031, 5545, 3606, 2191, 1230, 628, 285, 111, 35, 8, 1
Offset: 1

Views

Author

Keywords

Comments

T(n,k) is the number of permutations of {1..n} with k inversions.
n-th row gives growth series for symmetric group S_n with respect to transpositions (1,2), (2,3), ..., (n-1,n).
T(n,k) is the number of permutations of (1,2,...,n) having disorder equal to k. The disorder of a permutation p of (1,2,...,n) is defined in the following manner. We scan p from left to right as often as necessary until all its elements are removed in increasing order, scoring one point for each occasion on which an element is passed over and not removed. The disorder of p is the number of points scored by the end of the scanning and removal process. For example, the disorder of (3,5,2,1,4) is 8, since on the first scan, 3,5,2 and 4 are passed over, on the second, 3,5 and 4 and on the third scan, 5 is once again not removed. - Emeric Deutsch, Jun 09 2004
T(n,k) is the number of permutations p=(p(1),...,p(n)) of {1..n} such that Sum_{i: p(i)>p(i+1)} = k (k is called the Major index of p). Example: T(3,0)=1, T(3,1)=2, T(3,2)=2, T(3,3)=1 because the major indices of the permutations (1,2,3), (2,1,3), (3,1,2), (1,3,2), (2,3,1) and (3,2,1) are 0,1,1,2,2 and 3, respectively. - Emeric Deutsch, Aug 17 2004
T(n,k) is the number of 2 X c matrices with column totals 1,2,3,...,n and row totals k and binomial(n+1,2) - k. - Mitch Harris, Jan 13 2006
T(n,k) is the number of permutations p of {1,2,...,n} for which den(p)=k. Here den is the Denert statistic, defined in the following way: let p=p(1)p(2)...p(n) be a permutation of {1,2,...,n}; if p(i)>i, then we say that i is an excedance of p; let i_1 < i_2 < ... < i_k be the excedances of p and let j_1 < j_2 < ... < j_{n-k} be the non-excedances of p; let Exc(p) = p(i_1)p(i_2)...p(i_k), Nexc(p)=p(j_1)p(j_2)...p(j_{n-k}); then, by definition den(p) = i_1 + i_2 + ... + i_k + inv(Exc(p)) + inv(Nexc(p)), where inv denotes "number of inversions". Example: T(4,5)=3 because we have 1342, 3241 and 4321. We show that den(4321)=5: the excedances are 1 and 2; Exc(4321)=43, Nexc(4321)=21; now den(4321) = 1 + 2 + inv(43) + inv(21) = 3+1+1 = 5. - Emeric Deutsch, Oct 29 2008
T(n,k) is the number of size k submultisets of the multiset {1,2,2,3,3,3,...,n-1} (which contains i copies of i for 0 < i < n).
The limit of products of the numbers of fixed necklaces of length n composed of beads of types N(n,b), n --> infinity, is the generating function for inversions (we must exclude one unimportant factor b^n/n!). The error is < (b^n/n!)*O(1/n^(1/2-epsilon)). See Gaichenkov link. - Mikhail Gaichenkov, Aug 27 2012
The number of ways to distribute k-1 indistinguishable balls into n-1 boxes of capacity 1,2,3,...,n-1. - Andrew Woods, Sep 26 2012
Partial sums of rows give triangle A161169. - András Salamon, Feb 16 2013
The number of permutations of n that require k pair swaps in the bubble sort to sort them into the natural 1,2,...,n order. - R. J. Mathar, May 04 2013
Also series coefficients of q-factorial [n]q ! -- see Mathematica line. - _Wouter Meeussen, Jul 12 2014
From Mikhail Gaichenkov, Aug 16 2016: (Start)
Following asymptotic expansions in the Central Limit Theorem developed by Valentin V. Petrov, the cumulative distribution function of these numbers, CDF_N(x), is equal to the CDF of the normal distribution - (0.06/sqrt(2*Pi))*exp(-x^2/2)(x^3-3x)*(6N^3+21N^2+31N+31)/(N(2N+5)^2(N-1)+O(1/N^2).
This can be written as: CDF of the normal distribution -(0.09/(N*sqrt(2*Pi)))*exp(-x^2/2)*He_3(x) + O(1/N^2), N > 1, natural numbers (Gaichenkov, private research).
According to B. H. Margolius, Permutations with inversions, J. Integ. Seqs. Vol. 4 (2001), #01.2.4, "the unimodal behavior of the inversion numbers suggests that the number of inversions in a random permutation may be asymptotically normal". See links.
Moreover, E. Ben-Naim (Theoretical Division and Center for Nonlinear Studies, Los Alamos National Laboratory), "On the Mixing of Diffusing Particles" (13 Oct 2010), states that the Mahonian Distribution becomes a function of a single variable for large numbers of element, i.e., the probability distribution function is normal. See links.
To be more precise the expansion of the distribution is presented for a finite number of elements (or particles in terms of E. Ben-Naim's article). The distribution tends to the normal distribution for an infinite numbers of elements.
(End)
T(n,k) statistic counts (labeled) permutation graphs with n vertices and k edges. - Mikhail Gaichenkov, Aug 20 2019
From Gus Wiseman, Aug 12 2020: (Start)
Number of divisors of A006939(n - 1) or A076954(n - 1) with k prime factors, counted with multiplicity, where A006939(n) = Product_{i = 1..n} prime(i)^(n - i + 1). For example, row n = 4 counts the following divisors:
1 2 4 8 24 72 360
3 6 12 36 120
5 9 18 40 180
10 20 60
15 30 90
45
Crossrefs:
A336420 is the case with distinct prime multiplicities.
A006939 lists superprimorials or Chernoff numbers.
A022915 counts permutations of prime indices of superprimorials.
A317829 counts factorizations of superprimorials.
A336941 counts divisor chains under superprimorials.
(End)
Named after the British mathematician Percy Alexander MacMahon (1854-1929). - Amiram Eldar, Jun 13 2021
Row maxima ~ n!/(sigma * sqrt(2*Pi)), sigma^2 = (2*n^3 + 9*n^2 + 7*n)/72 = variance of group type A_n (see also A161435). - Mikhail Gaichenkov, Feb 08 2023
Sum_{i>=0} T(n,i)*k^i = A069777(n,k). - Geoffrey Critzer, Feb 26 2025

Examples

			1; 1+x; (1+x)*(1+x+x^2) = 1+2*x+2*x^2+x^3; etc.
Triangle begins:
  n\k| 0  1   2    3    4     5     6     7     8      9     10
  ---+--------------------------------------------------------------
   1 | 1;
   2 | 1, 1;
   3 | 1, 2,  2,   1;
   4 | 1, 3,  5,   6,   5,    3,    1;
   5 | 1, 4,  9,  15,  20,   22,   20,   15,    9,     4,     1;
   6 | 1, 5, 14,  29,  49,   71,   90,  101,  101,    90,    71, ...
   7 | 1, 6, 20,  49,  98,  169,  259,  359,  455,   531,   573, ...
   8 | 1, 7, 27,  76, 174,  343,  602,  961, 1415,  1940,  2493, ...
   9 | 1, 8, 35, 111, 285,  628, 1230, 2191, 3606,  5545,  8031, ...
  10 | 1, 9, 44, 155, 440, 1068, 2298, 4489, 8095, 13640, 21670, ...
From _Gus Wiseman_, Aug 12 2020: (Start)
Row n = 4 counts the following submultisets of {1,1,1,2,2,3}:
  {}  {1}  {11}  {111}  {1112}  {11122}  {111223}
      {2}  {12}  {112}  {1122}  {11123}
      {3}  {22}  {122}  {1113}  {11223}
           {13}  {113}  {1123}
           {23}  {123}  {1223}
                 {223}
(End)
		

References

  • Miklós Bóna, Combinatorics of permutations, Chapman & Hall/CRC, Boca Raton, Florida, 2004 (p. 52).
  • Louis Comtet, Advanced Combinatorics, Reidel, 1974, p. 240.
  • Florence Nightingale David, Maurice George Kendall, and David Elliot Barton, Symmetric Function and Allied Tables, Cambridge, 1966, p. 241.
  • Pierre de la Harpe, Topics in Geometric Group Theory, Univ. Chicago Press, 2000, p. 163, top display.
  • Eugen Netto, Lehrbuch der Combinatorik. 2nd ed., Teubner, Leipzig, 1927, p. 96.
  • Valentin V. Petrov, Sums of Independent Random Variables, Springer Berlin Heidelberg, 1975, p. 134.
  • Richard P. Stanley, Enumerative Combinatorics, Cambridge, Vol. 1, 1999; see Corollary 1.3.10, p. 21.

Crossrefs

Diagonals: A000707 (k=n-1), A001892 (k=n-2), A001893 (k=n-3), A001894 (k=n-4), A005283 (k=n-5), A005284 (k=n-6), A005285 (k=n-7).
Columns: A005286 (k=3), A005287 (k=4), A005288 (k=5), A242656 (k=6), A242657 (k=7).
Rows: A161435 (n=4), A161436 (n=5), A161437 (n=6), A161438 (n=7), A161439 (n=8), A161456 (n=9), A161457 (n=10).
Row-maxima: A000140, truncated table: A060701, row sums: A000142, row lengths: A000124.
A001809 gives total Denert index of all permutations.
A357611 gives a refinement.

Programs

  • Maple
    g := proc(n,k) option remember; if k=0 then return(1) else if (n=1 and k=1) then return(0) else if (k<0 or k>binomial(n,2)) then return(0) else g(n-1,k)+g(n,k-1)-g(n-1,k-n) end if end if end if end proc; # Barbara Haas Margolius (margolius(AT)math.csuohio.edu), May 31 2001
    BB:=j->1+sum(t^i, i=1..j): for n from 1 to 8 do Z[n]:=sort(expand(simplify(product(BB(j), j=0..n-2)))) od: for n from 1 to 8 do seq(coeff(Z[n], t, j), j=0..(n-1)*(n-2)/2) od; # Zerinvary Lajos, Apr 13 2007
    # alternative Maple program:
    b:= proc(u, o) option remember; expand(`if`(u+o=0, 1,
           add(b(u+j-1, o-j)*x^(u+j-1), j=1..o)+
           add(b(u-j, o+j-1)*x^(u-j), j=1..u)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0)):
    seq(T(n), n=1..10);  # Alois P. Heinz, May 02 2017
  • Mathematica
    f[n_] := CoefficientList[ Expand@ Product[ Sum[x^i, {i, 0, j}], {j, n}], x]; Flatten[Array[f, 8, 0]]
    (* Second program: *)
    T[0, 0] := 1; T[-1, k_] := 0;
    T[n_, k_] := T[n, k] = If[0 <= k <= n*(n - 1)/2, T[n, k - 1] + T[n - 1, k] - T[n - 1, k - n], 0]; (* Peter Kagey, Mar 18 2021; corrected the program by Mats Granvik and Roger L. Bagula, Jun 19 2011 *)
    alternatively (versions 7 and up):
    Table[CoefficientList[Series[QFactorial[n,q],{q,0,n(n-1)/2}],q],{n,9}] (* Wouter Meeussen, Jul 12 2014 *)
    b[u_, o_] := b[u, o] = Expand[If[u + o == 0, 1,
       Sum[b[u + j - 1, o - j]*x^(u + j - 1), {j, 1, o}] +
       Sum[b[u - j, o + j - 1]*x^(u - j), {j, 1, u}]]];
    T[n_] := With[{p = b[n, 0]}, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]];
    Table[T[n], {n, 1, 10}] // Flatten (* Jean-François Alcover, Apr 21 2025, after Alois P. Heinz *)
  • PARI
    {T(n,k) = my(A=1+x); for(i=1,n, A = 1 + intformal(A - q*subst(A,x,q*x +x^2*O(x^n)))/(1-q)); polcoeff(n!*polcoeff(A,n,x),k,q)}
    for(n=1,10, for(k=0,n*(n-1)/2, print1(T(n,k),", ")); print("")) \\ Paul D. Hanna, Dec 31 2016
    
  • PARI
    row(n)=Vec(prod(k=1,n,(1-'q^k)/(1-'q))); \\ Joerg Arndt, Apr 13 2019
  • Sage
    from sage.combinat.q_analogues import q_factorial
    for n in (1..6): print(q_factorial(n).list()) # Peter Luschny, Jul 18 2016
    

Formula

Bourget, Comtet and Moritz-Williams give recurrences.
Mendes and Stanley give g.f.'s.
G.f.: Product_{j=1..n} (1-x^j)/(1-x) = Sum_{k=0..M} T{n, k} x^k, where M = n*(n-1)/2.
From Andrew Woods, Sep 26 2012, corrected by Peter Kagey, Mar 18 2021: (Start)
T(1, 0) = 1,
T(n, k) = 0 for n < 0, k < 0 or k > n*(n-1)/2.
T(n, k) = Sum_{j=0..n-1} T(n-1, k-j),
T(n, k) = T(n, k-1) + T(n-1, k) - T(n-1, k-n). (End)
E.g.f. satisfies: A(x,q) = 1 + Integral (A(x,q) - q*A(q*x,q))/(1-q) dx, where A(x,q) = Sum_{n>=0} x^n/n! * Sum_{k=0..n*(n-1)/2} T(n,k)*q^k, when T(0,0) = 1 is included. - Paul D. Hanna, Dec 31 2016

Extensions

There were some mistaken edits to this entry (inclusion of an initial 1, etc.) which I undid. - N. J. A. Sloane, Nov 30 2009
Added mention of "major index" to definition. - N. J. A. Sloane, Feb 10 2019

A034968 Minimal number of factorials that add to n.

Original entry on oeis.org

0, 1, 1, 2, 2, 3, 1, 2, 2, 3, 3, 4, 2, 3, 3, 4, 4, 5, 3, 4, 4, 5, 5, 6, 1, 2, 2, 3, 3, 4, 2, 3, 3, 4, 4, 5, 3, 4, 4, 5, 5, 6, 4, 5, 5, 6, 6, 7, 2, 3, 3, 4, 4, 5, 3, 4, 4, 5, 5, 6, 4, 5, 5, 6, 6, 7, 5, 6, 6, 7, 7, 8, 3, 4, 4, 5, 5, 6, 4, 5, 5, 6, 6, 7, 5, 6, 6, 7, 7, 8, 6, 7, 7, 8, 8, 9, 4, 5, 5, 6, 6, 7, 5, 6, 6, 7
Offset: 0

Views

Author

Keywords

Comments

Equivalently, sum of digits when n is written in factorial base (A007623).
Equivalently, a(0)...a(n!-1) give the total number of inversions of the permutations of n elements in lexicographic order (the factorial numbers in rising base are the inversion tables of the permutations and their sum of digits give the total number of inversions, see example and the Fxtbook link). - Joerg Arndt, Jun 17 2011
Also minimum number of adjacent transpositions needed to produce each permutation in the list A055089, or number of swappings needed to bubble sort each such permutation. (See A055091 for the minimum number of any transpositions.)

Examples

			a(205) = a(1!*1 + 3!*2 + 4!*3 + 5!*1) = 1+2+3+1 = 7. [corrected by Shin-Fu Tsai, Mar 23 2021]
From _Joerg Arndt_, Jun 17 2011: (Start)
   n:    permutation   inv. table a(n)  cycles
   0:    [ 0 1 2 3 ]   [ 0 0 0 ]   0    (0) (1) (2) (3)
   1:    [ 0 1 3 2 ]   [ 0 0 1 ]   1    (0) (1) (2, 3)
   2:    [ 0 2 1 3 ]   [ 0 1 0 ]   1    (0) (1, 2) (3)
   3:    [ 0 2 3 1 ]   [ 0 1 1 ]   2    (0) (1, 2, 3)
   4:    [ 0 3 1 2 ]   [ 0 2 0 ]   2    (0) (1, 3, 2)
   5:    [ 0 3 2 1 ]   [ 0 2 1 ]   3    (0) (1, 3) (2)
   6:    [ 1 0 2 3 ]   [ 1 0 0 ]   1    (0, 1) (2) (3)
   7:    [ 1 0 3 2 ]   [ 1 0 1 ]   2    (0, 1) (2, 3)
   8:    [ 1 2 0 3 ]   [ 1 1 0 ]   2    (0, 1, 2) (3)
   9:    [ 1 2 3 0 ]   [ 1 1 1 ]   3    (0, 1, 2, 3)
  10:    [ 1 3 0 2 ]   [ 1 2 0 ]   3    (0, 1, 3, 2)
  11:    [ 1 3 2 0 ]   [ 1 2 1 ]   4    (0, 1, 3) (2)
  12:    [ 2 0 1 3 ]   [ 2 0 0 ]   2    (0, 2, 1) (3)
  13:    [ 2 0 3 1 ]   [ 2 0 1 ]   3    (0, 2, 3, 1)
  14:    [ 2 1 0 3 ]   [ 2 1 0 ]   3    (0, 2) (1) (3)
  15:    [ 2 1 3 0 ]   [ 2 1 1 ]   4    (0, 2, 3) (1)
  16:    [ 2 3 0 1 ]   [ 2 2 0 ]   4    (0, 2) (1, 3)
  17:    [ 2 3 1 0 ]   [ 2 2 1 ]   5    (0, 2, 1, 3)
  18:    [ 3 0 1 2 ]   [ 3 0 0 ]   3    (0, 3, 2, 1)
  19:    [ 3 0 2 1 ]   [ 3 0 1 ]   4    (0, 3, 1) (2)
  20:    [ 3 1 0 2 ]   [ 3 1 0 ]   4    (0, 3, 2) (1)
  21:    [ 3 1 2 0 ]   [ 3 1 1 ]   5    (0, 3) (1) (2)
  22:    [ 3 2 0 1 ]   [ 3 2 0 ]   5    (0, 3, 1, 2)
  23:    [ 3 2 1 0 ]   [ 3 2 1 ]   6    (0, 3) (1, 2)
(End)
		

Crossrefs

Cf. A368342 (partial sums), A001809 (sums of n! terms).
Cf. A227148 (positions of even terms), A227149 (of odd terms).
Differs from analogous A276150 for the first time at n=24.
Positions of records are A200748.

Programs

  • Maple
    [seq(convert(fac_base(j),`+`),j=0..119)]; # fac_base and PermRevLexUnrank given in A055089. Perm2InversionVector in A064039
    Or alternatively: [seq(convert(Perm2InversionVector(PermRevLexUnrank(j)),`+`),j=0..119)];
    # third Maple program:
    b:= proc(n, i) local q;
          `if`(n=0, 0, b(irem(n, i!, 'q'), i-1)+q)
        end:
    a:= proc(n) local k;
          for k while k!Alois P. Heinz, Nov 15 2012
  • Mathematica
    a[n_] := Module[{s=0, i=2, k=n}, While[k > 0, k = Floor[n/i!]; s = s + (i-1)*k; i++]; n-s]; Table[a[n], {n, 0, 105}] (* Jean-François Alcover, Nov 06 2013, after Benoit Cloitre *)
  • PARI
    a(n)=local(k,r);k=2;r=0;while(n>0,r+=n%k;n\=k;k++);r \\ Franklin T. Adams-Watters, May 13 2009
    
  • Python
    def a(n):
        k=2
        r=0
        while n>0:
            r+=n%k
            n=n//k
            k+=1
        return r
    print([a(n) for n in range(201)]) # Indranil Ghosh, Jun 19 2017, after PARI program
    
  • Python
    def A034968(n, p=2): return n if n
  • Scheme
    (define (A034968 n) (let loop ((n n) (i 2) (s 0)) (cond ((zero? n) s) (else (loop (quotient n i) (+ 1 i) (+ s (remainder n i)))))))
    ;; Antti Karttunen, Aug 29 2016
    

Formula

a(n) = n - Sum_{i>=2} (i-1)*floor(n/i!). - Benoit Cloitre, Aug 26 2003
G.f.: 1/(1-x)*Sum_{k>0} (Sum_{i=1..k} i*x^(i*k!))/(Sum_{i=0..k} x^(i*k!)). - Franklin T. Adams-Watters, May 13 2009
From Antti Karttunen, Aug 29 2016: (Start)
a(0) = 0; for n >= 1, a(n) = A099563(n) + a(A257687(n)).
a(0) = 0; for n >= 1, a(n) = A060130(n) + a(A257684(n)).
Other identities. For all n >= 0:
a(n) = A001222(A276076(n)).
a(n) = A276146(A225901(n)).
a(A000142(n)) = 1, a(A007489(n)) = n, a(A033312(n+1)) = A000217(n).
a(A056019(n)) = a(n).
A219651(n) = n - a(n).
(End)

Extensions

Additional comments from Antti Karttunen, Aug 23 2001

A021009 Triangle of coefficients of Laguerre polynomials n!*L_n(x) (rising powers of x).

Original entry on oeis.org

1, 1, -1, 2, -4, 1, 6, -18, 9, -1, 24, -96, 72, -16, 1, 120, -600, 600, -200, 25, -1, 720, -4320, 5400, -2400, 450, -36, 1, 5040, -35280, 52920, -29400, 7350, -882, 49, -1, 40320, -322560, 564480, -376320, 117600, -18816, 1568, -64, 1, 362880, -3265920
Offset: 0

Views

Author

Keywords

Comments

In absolute values, this sequence also gives the lower triangular readout of the exponential of a matrix whose entry {j+1,j} equals (j-1)^2 (and all other entries are zero). - Joseph Biberstine (jrbibers(AT)indiana.edu), May 26 2006
A partial permutation on a set X is a bijection between two subsets of X. |T(n,n-k)| equals the numbers of partial permutations of an n-set having domain cardinality equal to k. Let E denote the operator D*x*D, where D is the derivative operator d/dx. Then E^n = Sum_{k = 0..n} |T(n,k)|*x^k*D^(n+k). - Peter Bala, Oct 28 2008
The unsigned triangle is the generalized Riordan array (exp(x), x) with respect to the sequence n!^2 as defined by Wang and Wang (the generalized Riordan array (exp(x), x) with respect to the sequence n! is Pascal's triangle A007318, and with respect to the sequence n!*(n+1)! is A105278). - Peter Bala, Aug 15 2013
The unsigned triangle appears on page 83 of Ser (1933). - N. J. A. Sloane, Jan 16 2020

Examples

			The triangle a(n,m) starts:
n\m   0       1      2       3      4      5    6  7  8
0:    1
1:    1      -1
2:    2      -4      1
3:    6     -18      9      -1
4:   24     -96     72     -16      1
5:  120    -600    600    -200     25     -1
6:  720   -4320   5400   -2400    450    -36    1
7: 5040  -35280  52920  -29400   7350   -882   49  -1
8:40320 -322560 564480 -376320 117600 -18816 1568 -64 1
...
From _Wolfdieter Lang_, Jan 31 2013 (Start)
Recurrence (usual one): a(4,1) = 7*(-18) - 6 - 3^2*(-4) = -96.
Recurrence (simplified version): a(4,1) = 5*(-18) - 6 = -96.
Recurrence (Sage program): |a(4,1)| = 6 + 3*18 + 4*9 = 96. (End)
Embedded recurrence (Maple program): a(4,1) = -4!*(1 + 3) = -96.
		

References

  • M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 799.
  • G. Rota, Finite Operator Calculus, Academic Press, New York, 1975.
  • J. Ser, Les Calculs Formels des Séries de Factorielles. Gauthier-Villars, Paris, 1933, p. 83.

Crossrefs

Row sums give A009940, alternating row sums are A002720.
Column sequences (unsigned): A000142, A001563, A001809-A001812 for m=0..5.
Central terms: A295383.
For generators and generalizations see A132440.

Programs

  • Magma
    /* As triangle: */ [[((-1)^k)*Factorial(n)*Binomial(n, k)/Factorial(k): k in [0..n]]: n in [0.. 10]]; // Vincenzo Librandi, Jan 18 2020
  • Maple
    A021009 := proc(n,k) local S; S := proc(n,k) option remember; `if`(k = 0, 1, `if`( k > n, 0, S(n-1,k-1)/k + S(n-1,k))) end: (-1)^k*n!*S(n,k) end: seq(seq(A021009(n,k), k=0..n), n=0..8); # Peter Luschny, Jun 21 2017
    # Alternative for the unsigned case (function RiordanSquare defined in A321620):
    RiordanSquare(add(x^m, m=0..10), 10, true); # Peter Luschny, Dec 06 2018
  • Mathematica
    Flatten[ Table[ CoefficientList[ n!*LaguerreL[n, x], x], {n, 0, 9}]] (* Jean-François Alcover, Dec 13 2011 *)
  • PARI
    p(n) = denominator(bestapprPade(Ser(vector(2*n, k, (k-1)!))));
    concat(1, concat(vector(9, n, Vec(-p(n)))))  \\ Gheorghe Coserea, Dec 01 2016
    
  • PARI
    {T(n, k) = if( n<0, 0, n! * polcoeff( sum(i=0, n, binomial(n, n-i) * (-x)^i / i!), k))}; /* Michael Somos, Dec 01 2016 */
    
  • PARI
    row(n) = Vecrev(n!*pollaguerre(n)); \\ Michel Marcus, Feb 06 2021
    
  • Sage
    def A021009_triangle(dim): # computes unsigned T(n,k).
        M = matrix(ZZ,dim,dim)
        for n in (0..dim-1): M[n,n] = 1
        for n in (1..dim-1):
            for k in (0..n-1):
                M[n,k] = M[n-1,k-1]+(2*k+1)*M[n-1,k]+(k+1)^2*M[n-1,k+1]
        return M
    A021009_triangle(9) # Peter Luschny, Sep 19 2012
    

Formula

a(n, m) = ((-1)^m)*n!*binomial(n, m)/m! = ((-1)^m)*((n!/m!)^2)/(n-m)! if n >= m, otherwise 0.
E.g.f. for m-th column: (-x/(1-x))^m /((1-x)*m!), m >= 0.
Representation (of unsigned a(n, m)) as special values of Gauss hypergeometric function 2F1, in Maple notation: n!*(-1)^m*hypergeom([ -m, n+1 ], [ 1 ], 1)/m!. - Karol A. Penson, Oct 02 2003
Sum_{m>=0} (-1)^m*a(n, m) = A002720(n). - Philippe Deléham, Mar 10 2004
E.g.f.: (1/(1-x))*exp(x*y/(x-1)). - Vladeta Jovovic, Apr 07 2005
Sum_{n>=0, m>=0} a(n, m)*(x^n/n!^2)*y^m = exp(x)*BesselJ(0, 2*sqrt(x*y)). - Vladeta Jovovic, Apr 07 2005
Matrix square yields the identity matrix: L^2 = I. - Paul D. Hanna, Nov 22 2008
From Tom Copeland, Oct 20 2012: (Start)
Symbolically, with D=d/dx and LN(n,x)=n!L_n(x), define :Dx:^j = D^j x^j, :xD:^j = x^j D^j, and LN(.,x)^j = LN(j,x) = row polynomials of A021009.
Then some useful relations are
1) (:Dx:)^n = LN(n,-:xD:) [Rodriguez formula]
2) (xDx)^n = x^n D^n x^n = x^n LN(n,-:xD:) [See Al-Salam ref./A132440]
3) (DxD)^n = D^n x^n D^n = LN(n,-:xD:) D^n [See ref. in A132440]
4) umbral composition LN(n,LN(.,x))= x^n [See Rota ref.]
5) umbral comp. LN(n,-:Dx:) = LN(n,-LN(.,-:xD:)) = 2^n LN(n,-:xD:/2)= n! * (n-th row e.g.f.(x) of A038207 with x replaced by :xD:).
An example for 2) is the operator (xDx)^2 = (xDx)(xDx) = xD(x^2 + x^3D)= 2x^2 + 4x^3 D + x^4 D^2 = x^2 (2 + 4x D + x^2 D^2) = x^2 (2 + 4 :xD: + :xD:^2) = x^2 LN(2,-:xD:) = x^2 2! L_2(-:xD:).
An example of the umbral composition in 5) is given in A038207.
The op. xDx is related to the Euler/binomial transformation for power series/o.g.f.s. through exp(t*xDx) f(x) = f[x/(1-t*x)]/(1-t*x) and to the special Moebius/linear fractional/projective transformation z exp(-t*zDz)(1/z)f(z) = f(z/(1+t*z)).
For a general discussion of umbral calculus see the Gessel link. (End)
From Wolfdieter Lang, Jan 31 2013: (Start)
Standard recurrence derived from the three term recurrence of the orthogonal polynomials system {n!*L(n,x)}: L(n,x) = (2*n - 1 - x)*L(n-1,x) - (n-1)^2*L(n-2,x), n>=1, L(-1,x) = 0, L(0,x) = 1.
a(n,m) = (2*n-1)*a(n-1,m) - a(n-1,m-1) - (n-1)^2*a(n-2,m),
n >=1, with a(n,-1) = 0, a(0,0) = 1, a(n,m) = 0 if n < m. (compare this with Peter Luschny's program for the unsigned case |a(n,m)| = (-1)^m*a(n,m)).
Simplified recurrence (using column recurrence from explicit form for a(n,m) given above):
a(n,m) = (n+m)*a(n-1,m) - a(n-1,m-1), n >= 1, a(0,0) = 1, a(n,-1) = 0, a(n,m) = 0 if n < m. (End)
|T(n,k)| = [x^k] (-1)^n*U(-n,1,-x), where U(a,b,x) is Kummer's hypergeometric U function. - Peter Luschny, Apr 11 2015
T(n,k) = (-1)^k*n!*S(n,k) where S(n,k) is recursively defined by: "if k = 0 then 1 else if k > n then 0 else S(n-1,k-1)/k + S(n-1,k)". - Peter Luschny, Jun 21 2017
The unsigned case is the exponential Riordan square (see A321620) of the factorial numbers. - Peter Luschny, Dec 06 2018
Omitting the diagonal and signs, this array is generated by the commutator [D^n,x^n] = D^n x^n - x^n D^n = Sum_{i=0..n-1} ((n!/i!)^2/(n-i)!) x^i D^i on p. 9 of both papers by Belov-Kanel and Kontsevich. - Tom Copeland, Jan 23 2020

Extensions

Name changed and table given by Wolfdieter Lang, Nov 28 2011

A064038 Numerator of average number of swaps needed to bubble sort a string of n distinct letters.

Original entry on oeis.org

0, 1, 3, 3, 5, 15, 21, 14, 18, 45, 55, 33, 39, 91, 105, 60, 68, 153, 171, 95, 105, 231, 253, 138, 150, 325, 351, 189, 203, 435, 465, 248, 264, 561, 595, 315, 333, 703, 741, 390, 410, 861, 903, 473, 495, 1035, 1081, 564, 588, 1225, 1275, 663, 689, 1431, 1485, 770
Offset: 1

Views

Author

Antti Karttunen, Aug 23 2001

Keywords

Comments

Denominators are given by the simple periodic sequence [1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, ...] (= A014695) thus we get an average of 1/2, 3/2, 3, 5, 15/2, 21/2, 14, 18, etc. swappings required to bubble sort a string of 2, 3, 4, 5, 6, ... letters.

References

  • E. Reingold, J. Nievergelt and N. Deo, Combinatorial Algorithms, Prentice-Hall, 1977, section 7.1, p. 287.

Crossrefs

Programs

  • Magma
    [Numerator(n*(n-1)/4): n in [1..100]]; // G. C. Greubel, Sep 21 2018
  • Maple
    [seq(numer((n*(n-1))/4), n=1..120)];
  • Mathematica
    f[n_] := Numerator[n (n - 1)/4]; Array[f, 56]
    f[n_] := n/GCD[n, 4]; Array[f[#] f[# - 1] &, 56]
    LinearRecurrence[{3,-6,10,-12,12,-10,6,-3,1},{0,1,3,3,5,15,21,14,18},80] (* Harvey P. Dale, Jan 23 2023 *)
  • PARI
    vector(100, n, numerator(n*(n-1)/4)) \\ G. C. Greubel, Sep 21 2018
    

Formula

a(n) = numerator(A001809(n)/(n!)).
a(4n) = A033991(n).
a(4n+1) = A007742(n).
a(4n+2) = A014634(n).
a(4n+3) = A033567(n+1).
a(n+1) = A061041(8*n-4). - Paul Curtz, Jan 03 2011
G.f.: -x^2*(1+4*x^3+x^6) / ( (x-1)^3*(1+x^2)^3 ). - R. J. Mathar, Jan 03 2011
a(n+1) = A060819(n)*A060819(n+1).
a(n+1) = A000217(n)/(period 4:repeat 2,1,1,2=A014695(n+2)=A130658(n+3)).
a(n) = 3*a(n-4) -3*a(n-8) +a(n-12). - Paul Curtz, Mar 04 2011
a(n) = +3*a(n-1) -6*a(n-2) +10*a(n-3) -12*a(n-4) +12*a(n-5) -10*a(n-6) +6*a(n-7) -3*a(n-8) +1*a(n-9). - Joerg Arndt, Mar 04 2011
a(n+1) = A026741(A000217(n)). - Paul Curtz, Apr 04 2011
a(n) = numerator(Sum_{k=0..n-1} k/2). - Arkadiusz Wesolowski, Aug 09 2012
a(n) = n*(n-1)*(3-i^(n*(n-1)))/8, where i=sqrt(-1). - Bruno Berselli, Oct 01 2012, corrected by Vaclav Kotesovec, Aug 09 2022
Sum_{n>=2} 1/a(n) = 4 - Pi/2. - Amiram Eldar, Aug 09 2022
E.g.f.: x^2*(3*exp(x) + cos(x) + sin(x))/8. - Stefano Spezia, Aug 23 2025

A053495 Triangle formed by coefficients of numerator polynomials defined by iterating f(u,v) = 1/u - x*v applied to a list of elements {1,2,3,4,...}.

Original entry on oeis.org

1, 1, -1, -1, 2, -2, 1, -4, 6, -6, -1, 6, -18, 24, -24, 1, -9, 36, -96, 120, -120, -1, 12, -72, 240, -600, 720, -720, 1, -16, 120, -600, 1800, -4320, 5040, -5040, -1, 20, -200, 1200, -5400, 15120, -35280, 40320, -40320, 1, -25, 300, -2400, 12600
Offset: 0

Views

Author

Wouter Meeussen, Jan 27 2001

Keywords

Examples

			1, 1 - x, -1 + 2*x - 2*x^2, 1 - 4*x + 6*x^2 - 6*x^3, ...
		

Crossrefs

Diagonals give A000142, A001563, A001286, A001809, A001754, A001810, A001755, A001811, A001777. Except for first term, row sums give negative of A058307.
Row sums of positive entries give A001053, those of negative entries give -1*A001040.

Programs

  • Mathematica
    CoefficientList[ #, x ]&/@Numerator[ FoldList[ (1/#1-x#2)&, 1, Range[ 12 ] ]//Together ]
    FoldList[(1/#1-x#2)&, 1, Range[4] ]//Together (a simpler version, which shows the rational functions)

Formula

Table[ (-1)^(r+c+1) binomial[Floor[(r+c)/2], Floor[(r-c)/2]] Floor[(r+c+1)/2]! / Floor[(r-c+1)/2]!, {r, 0, 7}, {c, 0, r}]
a[0] := -1; a[1] := 1-x; a[n_] := a[n]= n x a[n-1] + a[n-2] (matches sequence except for a[0]).

A001804 a(n) = n! * C(n,2).

Original entry on oeis.org

2, 18, 144, 1200, 10800, 105840, 1128960, 13063680, 163296000, 2195424000, 31614105600, 485707622400, 7933224499200, 137305808640000, 2510734786560000, 48373490221056000, 979563176976384000, 20801312169910272000, 462251381553561600000
Offset: 2

Views

Author

Keywords

Comments

Number of big descents in all permutations of [n+1]. A big descent in a permutation (x_1,x_2,...,x_n) is a position i such that x_i - x_(i+1) >= 2. Example: a(2)=2 because there are 2 big descents in the permutations 123, 132, 213, 23\1, 3\12, 321 of {1,2,3} (shown by a \). a(n)=Sum(k*A120434(n+1,k),k=0..n-1). - Emeric Deutsch, Oct 01 2006
a(n)/2 counts the total number of inversions in all the permutations of the set [n]; see A001809. - Peter Bala, Feb 28 2013
Equivalently, number of mappings f from a set X of n elements into itself such that f(X) has n-1 elements. - Robert FERREOL, Mar 14 2016

References

  • M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 799.
  • 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

Programs

  • Maple
    seq(n!*binomial(n,2),n=2..20); # Emeric Deutsch, Oct 01 2006
    a:=n->sum((n-j)*n!, j=1..n): seq(a(n), n=2..22); # Zerinvary Lajos, Apr 29 2007
    restart: G(x):=x^2/(1-x)^3: f[0]:=G(x): for n from 1 to 18 do f[n]:=diff(f[n-1],x) od: x:=0: seq(f[n],n=2..16); # Zerinvary Lajos, Apr 01 2009
  • Mathematica
    Table[n! Binomial[n, 2], {n, 2, 20}] (* T. D. Noe, Aug 10 2012 *)
  • PARI
    a(n) = n!*binomial(n, 2); \\ Michel Marcus, Mar 14 2016

Formula

E.g.f.: x^2/(1-x)^3. - Geoffrey Critzer, Aug 19 2012
a(n) = 2 * A001809(n).
From Ilya Gutkovskiy, Jan 20 2017: (Start)
a(n) ~ sqrt(Pi/2)*n^(n+5/2)/exp(n).
Sum_{n>=2} 1/a(n) = 2*(3 - exp(1)) = 0.563436343081909529... (End)

A061691 Triangle of generalized Stirling numbers.

Original entry on oeis.org

1, 1, 2, 1, 9, 6, 1, 34, 72, 24, 1, 125, 650, 600, 120, 1, 461, 5400, 10500, 5400, 720, 1, 1715, 43757, 161700, 161700, 52920, 5040, 1, 6434, 353192, 2361016, 4116000, 2493120, 564480, 40320, 1, 24309, 2862330, 33731208, 96960024, 97161120, 39372480, 6531840, 362880
Offset: 1

Views

Author

N. J. A. Sloane, Jun 18 2001

Keywords

Comments

The Eulerian-type number triangle associated with this triangle of generalized Stirling numbers is A192721. The table entry T(n,k) gives the number of uniform block permutations of the set {1,2,...,n} partitioned into k blocks. An example is given below. T(n,k) also gives the number of games of simple patience with n cards resulting in k piles (adapt Algorithm 1.1.22 of Lankham). [Peter Bala, Jul 14 2011]

Examples

			Triangle begins:
  1;
  1,2;
  1,9,6;
  1,34,72,24;
  1,125,650,600,120;
  ...
T(4,2) = 34:
There are 7 partitions of the set {1,2,3,4} into 2 blocks. The four partitions {1,2,3}{4}, {1,2,4}{3}, {1,3,4}{2} and {2,3,4}{1} give rise to 4*4 = 16 uniform block permutations while the remaining 3 partitions {1,2}{3,4}, {1,3}{2,4} and {1,4}{2,3} give 2!*3*3 = 18 uniform block permutations : thus in total there are 16+18 = 34 block permutations between the set partitions of {1,2,3,4} into 2 blocks.
		

Crossrefs

Diagonals give A010763, A061690, A000142, A001809, A061689. Cf. A061692. A023998 (row sums), A192721, A192722.

Programs

  • Maple
    #A061691
    #J = sum {n>=0} z^n/n!^2
    J := BesselJ(0, 2*i*sqrt(z)):
    G := exp(x*(J(z)-1)):
    Gser := simplify(series(G, z = 0, 12)):
    for n from 1 to 10 do
    P[n] := n!^2*sort(coeff(Gser, z, n)) od:
    for n from 1 to 10 do seq(coeff(P[n],x,k), k = 1..n) od;
    # yields sequence in triangular form
    # second Maple program:
    b:= proc(n) option remember; expand(`if`(n=0, 1,
          add(x*b(n-i)*binomial(n, i)/i!, i=1..n)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i)/i!, i=1..n))(b(n)*n!):
    seq(T(n), n=1..12);  # Alois P. Heinz, Sep 10 2019
  • Mathematica
    max = 9; g := Exp[x*(BesselI[0, 2*Sqrt[z]] - 1)]; gser = Series[g, {z, 0, max}, {x, 0, max}]; t[n_, k_] := n!^2*SeriesCoefficient[ gser // Normal, {z, 0, n}, {x, 0, k}]; Flatten[ Table[ t[n, k], {n, 1, max}, {k, 1, n}]] (* Jean-François Alcover, Apr 04 2012, after Maple *)

Formula

T(n, k) = 1/k!*Sum multinomial(n, n_1, n_2, ..n_k)^2, where the sum extends over all compositions (n_1, n_2, .., n_k) of n into exactly k nonnegative parts. - Vladeta Jovovic, Apr 23 2003
From Peter Bala, Jul 14 2011: (Start)
The table entry T(n,k) may also be expressed as a sum over (unordered) partitions of n into k parts:
T(n,k) = sum {partitions m_1*1+...+m_n*n = n, m_1+...+m_n = k} 1/(m_1!*...*m_n!)*{n!/(1!^(m_1)*...*n!^(m_n))}^2.
Generating function:
Let J(z) = sum {n>=0} z^n/n!^2. Then
exp(x*(J(z)-1)) = 1 + x*z + (x + 2*x^2)*z^2/2!^2 + (x + 9*x^2 + 6*x^3)*z^3/3!^2 + ....
Relations with other sequences:
T(n,k) = 1/k!*A192722(n,k).
Row sums [1,3,16,131,...] = A023998. (End)
The row polynomials R(n,x) satisfy the recurrence equation R(n,x) = x*( sum {k = 0..n-1} binomial(n,k)*binomial(n-1,k)*R(k,x) ) with R(0,x) = 1. Also R(n,x + y) = sum {k = 0..n} binomial(n,k)^2*R(k,x)*R(n-k,y). - Peter Bala, Sep 17 2013

Extensions

More terms from Vladeta Jovovic, Apr 23 2003

A211606 Total number of inversions over all involutions of length n.

Original entry on oeis.org

0, 0, 1, 5, 26, 110, 490, 2086, 9240, 40776, 185820, 855580, 4048616, 19455800, 95773496, 479581480, 2454041920, 12776826816, 67849286160, 366455145936, 2015621873440, 11268605368160, 64074235576736, 370040657037920, 2171138049287296, 12928631894588800, 78139702237771200
Offset: 0

Views

Author

Geoffrey Critzer, Feb 10 2013

Keywords

Examples

			a(3) = 5 because in the involutions of {1,2,3}: (given in word form) 213, 321, 132, 123, there are respectively 1 + 3 + 1 + 0 = 5 inversions.
		

References

  • R. Sedgewick and P. Flajolet, Analysis of Algorithms, Addison Wesley, 1996, page 339.

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<3, n*(n-1)/2,
          n*((n-2)*(9*n-7) *a(n-1) +(n-1)*(9*n^2-13*n+2) *a(n-2))/
          ((n-2)*(9*n^2-31*n+24)))
        end:
    seq(a(n), n=0..30);  # Alois P. Heinz, Feb 12 2013
  • Mathematica
    (* first do *) Needs["Combinatorica`"] // Quiet (* then *)
    Table[Total[Map[Inversions, Involutions[n]]], {n, 0, 10}]
    a[ n_] := If[ n < 0, 0, n! SeriesCoefficient[ (x^2/2 + x^3/3 + x^4/4) Exp[x + x^2/2], {x, 0, n}]]; (* Michael Somos, Jun 03 2019 *)
  • PARI
    {a(n) = if( n<0, 0, n! * polcoeff( (x^2/2 + x^3/3 + x^4/4) * exp(x + x^2/2 + x * O(x^n)), n))}; /* Michael Somos, Jun 03 2019 */

Formula

From Alois P. Heinz, Feb 12 2013: (Start)
a(n) = a(n-1) + (n-1)*a(n-2) + A000085(n-2)*(n-1)^2 for n>1; a(0) = a(1) = 0.
a(n) = (n*(n-2)*(9*n-7) *a(n-1) +n*(n-1)*(9*n^2-13*n+2) *a(n-2))/ ((n-2)*(9*n^2-31*n+24)) for n>=3; a(n) = n*(n-1)/2 for n<3.
E.g.f.: (x^2/2 + x^3/3 + x^4/4) * exp(x + x^2/2).
(End)
a(n) ~ sqrt(2)/8 * n^(n/2+2)*exp(sqrt(n)-n/2-1/4) * (1-3/(8*sqrt(n))). - Vaclav Kotesovec, Aug 15 2013

Extensions

a(13)-a(15) from Alois P. Heinz, Feb 10 2013
Further terms from Alois P. Heinz, Feb 12 2013

A216239 Total number of inversions in all derangement permutations of [n].

Original entry on oeis.org

0, 0, 1, 4, 34, 260, 2275, 21784, 228676, 2614296, 32372805, 431971100, 6182204006, 94495208444, 1536740258599, 26498747241680, 482990781797000, 9279452377499504, 187442757190618761, 3971627425918503156, 88084356619901450410, 2040857112777615061300
Offset: 0

Views

Author

Alois P. Heinz, Mar 15 2013

Keywords

Examples

			a(2) = 1: (2,1) has 1 inversion.
a(3) = 4: (2,3,1), (3,1,2) have 2+2 = 4 inversions.
a(4) = 34: (2,1,4,3), (2,3,4,1), (2,4,1,3), (3,1,4,2), (3,4,1,2), (3,4,2,1), (4,1,2,3), (4,3,1,2), (4,3,2,1) have 2+3+3+3+4+5+3+5+6 = 34 inversions.
		

Crossrefs

Programs

  • Maple
    v:= proc(l) local i; for i to nops(l) do if l[i]=i then return 0 fi od;
          add(add(`if`(l[i]>l[j], 1, 0), j=i+1..nops(l)), i=1..nops(l)-1)
        end:
    a:= n-> add(v(d), d=combinat[permute](n)):
    seq(a(n), n=0..8);
    # second Maple program:
    a:= proc(n) option remember; `if`(n<3, n*(n-1)/2,
          n*((6*n^3-26*n^2+31*n-9)*a(n-1)+(n-1)*
          (6*n^2-8*n+1)*a(n-2))/((n-2)*(15-20*n+6*n^2)))
        end:
    seq(a(n), n=0..25);  # Alois P. Heinz, Aug 13 2013
  • Mathematica
    A216239[n_] := (1/12)*n*(3*(-1)^n*n + (n*(3*n - 1) + 1)*Subfactorial[n-1]); Table[a[n], {n, 0, 21}] (* Jean-François Alcover, Feb 05 2015, after Max Alekseyev *)
  • PARI
    A216239(n) = sum(k=0,n-2, (-1)^k * n!/k! * (3*n+k) * (n-k-1) )/12; /* Max Alekseyev, Aug 13 2013 */

Formula

a(n) = SUM(k=0..n-2, (-1)^k * n!/k! * (3*n+k)*(n-k-1) )/12. - Max Alekseyev, Aug 13 2013
a(n) = ( (3*n^2-n+1)*A000166(n) + (n-1)*(-1)^n )/12. - Max Alekseyev, Aug 14 2013
a(n) = Sum_{k>=1} A228924(n,k) * k. - Alois P. Heinz, Sep 22 2013
a(n) ~ n! * n^2 / (4*exp(1)). - Vaclav Kotesovec, Sep 10 2014

Extensions

Formula and terms a(15) onward from Max Alekseyev, Aug 13 2013
Showing 1-10 of 20 results. Next