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 114 results. Next

A055137 Regard triangle of rencontres numbers (see A008290) as infinite matrix, compute inverse, read by rows.

Original entry on oeis.org

1, 0, 1, -1, 0, 1, -2, -3, 0, 1, -3, -8, -6, 0, 1, -4, -15, -20, -10, 0, 1, -5, -24, -45, -40, -15, 0, 1, -6, -35, -84, -105, -70, -21, 0, 1, -7, -48, -140, -224, -210, -112, -28, 0, 1, -8, -63, -216, -420, -504, -378, -168, -36, 0, 1, -9, -80, -315, -720
Offset: 0

Views

Author

Christian G. Bower, Apr 25 2000

Keywords

Comments

The n-th row consists of coefficients of the characteristic polynomial of the adjacency matrix of the complete n-graph.
Triangle of coefficients of det(M(n)) where M(n) is the n X n matrix m(i,j)=x if i=j, m(i,j)=i/j otherwise. - Benoit Cloitre, Feb 01 2003
T is an example of the group of matrices outlined in the table in A132382--the associated matrix for rB(0,1). The e.g.f. for the row polynomials is exp(x*t) * exp(x) *(1-x). T(n,k) = Binomial(n,k)* s(n-k) where s = (1,0,-1,-2,-3,...) with an e.g.f. of exp(x)*(1-x) which is the reciprocal of the e.g.f. of A000166. - Tom Copeland, Sep 10 2008
Row sums are: {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...}. - Roger L. Bagula, Feb 20 2009
T is related to an operational calculus connecting an infinitesimal generator for fractional integro-derivatives with the values of the Riemann zeta function at positive integers (see MathOverflow links). - Tom Copeland, Nov 02 2012
The submatrix below the null subdiagonal is signed and row reversed A127717. The submatrix below the diagonal is A074909(n,k)s(n-k) where s(n)= -n, i.e., multiply the n-th diagonal by -n. A074909 and its reverse A135278 have several combinatorial interpretations. - Tom Copeland, Nov 04 2012
T(n,k) is the difference between the number of even (A145224) and odd (A145225) permutations (of an n-set) with exactly k fixed points. - Julian Hatfield Iacoponi, Aug 08 2024

Examples

			1; 0,1; -1,0,1; -2,-3,0,1; -3,-8,-6,0,1; ...
(Bagula's matrix has a different sign convention from the list.)
From _Roger L. Bagula_, Feb 20 2009: (Start)
  { 1},
  { 0,   1},
  {-1,   0,    1},
  { 2,  -3,    0,    1},
  {-3,   8,   -6,    0,     1},
  { 4, -15,   20,  -10,     0,    1},
  {-5,  24,  -45,   40,   -15,    0,    1},
  { 6, -35,   84, -105,    70,  -21,    0,   1},
  {-7,  48, -140,  224,  -210,  112,  -28,   0,   1},
  { 8, -63,  216, -420,   504, -378,  168, -36,   0, 1},
  {-9,  80, -315,  720, -1050, 1008, -630, 240, -45, 0, 1}
(End)
R(3,x) = (-1)^3*Sum_{permutations p in S_3} sign(p)*(-x)^(fix(p)).
    p   | fix(p) | sign(p) | (-1)^3*sign(p)*(-x)^fix(p)
========+========+=========+===========================
  (123) |    3   |    +1   |      x^3
  (132) |    1   |    -1   |       -x
  (213) |    1   |    -1   |       -x
  (231) |    0   |    +1   |       -1
  (312) |    0   |    +1   |       -1
  (321) |    1   |    -1   |       -x
========+========+=========+===========================
                           | R(3,x) = x^3 - 3*x - 2
- _Peter Bala_, Aug 08 2011
		

References

  • Norman Biggs, Algebraic Graph Theory, 2nd ed. Cambridge University Press, 1993. p. 17.
  • J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p.184 problem 3.

Crossrefs

Cf. A005563, A005564 (absolute values of columns 1, 2).
Cf. A000312.

Programs

  • Mathematica
    M[n_] := Table[If[i == j, x, 1], {i, 1, n}, {j, 1, n}]; a = Join[{{1}}, Flatten[Table[CoefficientList[Det[M[n]], x], {n, 1, 10}]]] (* Roger L. Bagula, Feb 20 2009 *)
    t[n_, k_] := (k-n+1)*Binomial[n, k]; Table[t[n, k], {n, 0, 10}, {k, 0, n}] // Flatten (* Jean-François Alcover, Nov 29 2013, after Pari *)
  • PARI
    T(n,k)=(1-n+k)*if(k<0 || k>n,0,n!/k!/(n-k)!)

Formula

G.f.: (x-n+1)*(x+1)^(n-1) = Sum_(k=0..n) T(n,k) x^k.
T(n, k) = (1-n+k)*binomial(n, k).
k-th column has o.g.f. x^k(1-(k+2)x)/(1-x)^(k+2). k-th row gives coefficients of (x-k)(x+1)^k. - Paul Barry, Jan 25 2004
T(n,k) = Coefficientslist[Det[Table[If[i == j, x, 1], {i, 1, n}, {k, 1, n}],x]. - Roger L. Bagula, Feb 20 2009
From Peter Bala, Aug 08 2011: (Start)
Given a permutation p belonging to the symmetric group S_n, let fix(p) be the number of fixed points of p and sign(p) its parity. The row polynomials R(n,x) have a combinatorial interpretation as R(n,x) = (-1)^n*Sum_{permutations p in S_n} sign(p)*(-x)^(fix(p)). An example is given below.
Note: The polynomials P(n,x) = Sum_{permutations p in S_n} x^(fix(p)) are the row polynomials of the rencontres numbers A008290. The integral results Integral_{x = 0..n} R(n,x) dx = n/(n+1) = Integral_{x = 0..-1} R(n,x) dx lead to the identities Sum_{p in S_n} sign(p)*(-n)^(1 + fix(p))/(1 + fix(p)) = (-1)^(n+1)*n/(n+1) = Sum_{p in S_n} sign(p)/(1 + fix(p)). The latter equality was Problem B6 in the 66th William Lowell Putnam Mathematical Competition 2005. (End)
From Tom Copeland, Jul 26 2017: (Start)
The e.g.f. in Copeland's 2008 comment implies this entry is an Appell sequence of polynomials P(n,x) with lowering and raising operators L = d/dx and R = x + d/dL log[exp(L)(1-L)] = x+1 - 1/(1-L) = x - L - L^2 - ... such that L P(n,x) = n P(n-1,x) and R P(n,x) = P(n+1,x).
P(n,x) = (1-L) exp(L) x^n = (1-L) (x+1)^n = (x+1)^n - n (x+1)^(n-1) = (x+1-n)(x+1)^(n-1) = (x+s.)^n umbrally, where (s.)^n = s_n = P(n,0).
The formalism of A133314 applies to the pair of entries A008290 and A055137.
The polynomials of this pair P_n(x) and Q_n(x) are umbral compositional inverses; i.e., P_n(Q.(x)) = x^n = Q_n(P.(x)), where, e.g., (Q.(x))^n = Q_n(x).
The exponential infinitesimal generator (infinigen) of this entry is the negated infinigen of A008290, the matrix (M) noted by Bala, related to A238363. Then e^M = [the lower triangular A008290], and e^(-M) = [the lower triangular A055137]. For more on the infinigens, see A238385. (End)
From the row g.f.s corresponding to Bagula's matrix example below, the n-th row polynomial has a zero of multiplicity n-1 at x = 1 and a zero at x = -n+1. Since this is an Appell sequence dP_n(x)/dx = n P_{n-1}(x), the critical points of P_n(x) have the same abscissas as the zeros of P_{n-1}(x); therefore, x = 1 is an inflection point for the polynomials of degree > 2 with P_n(1) = 0, and the one local extremum of P_n has the abscissa x = -n + 2 with the value (-n+1)^{n-1}, signed values of A000312. - Tom Copeland, Nov 15 2019
From Julian Hatfield Iacoponi, Aug 08 2024: (Start)
T(n,k) = A145224(n,k) - A145225(n,k).
T(n,k) = binomial(n,k)*(A003221(n-k)-A000387(n-k)). (End)

Extensions

Additional comments from Michael Somos, Jul 04 2002

A000166 Subfactorial or rencontres numbers, or derangements: number of permutations of n elements with no fixed points.

Original entry on oeis.org

1, 0, 1, 2, 9, 44, 265, 1854, 14833, 133496, 1334961, 14684570, 176214841, 2290792932, 32071101049, 481066515734, 7697064251745, 130850092279664, 2355301661033953, 44750731559645106, 895014631192902121, 18795307255050944540, 413496759611120779881, 9510425471055777937262
Offset: 0

Views

Author

Keywords

Comments

Euler (1809) not only gives the first ten or so terms of the sequence, he also proves both recurrences a(n) = (n-1)*(a(n-1) + a(n-2)) and a(n) = n*a(n-1) + (-1)^n.
a(n) is the permanent of the matrix with 0 on the diagonal and 1 elsewhere. - Yuval Dekel, Nov 01 2003
a(n) is the number of desarrangements of length n. A desarrangement of length n is a permutation p of {1,2,...,n} for which the smallest of all the ascents of p (taken to be n if there are no ascents) is even. Example: a(3) = 2 because we have 213 and 312 (smallest ascents at i = 2). See the J. Désarménien link and the Bona reference (p. 118). - Emeric Deutsch, Dec 28 2007
a(n) is the number of deco polyominoes of height n and having in the last column an even number of cells. A deco polyomino is a directed column-convex polyomino in which the height, measured along the diagonal, is attained only in the last column. - Emeric Deutsch, Dec 28 2007
Attributed to Nicholas Bernoulli in connection with a probability problem that he presented. See Problem #15, p. 494, in "History of Mathematics" by David M. Burton, 6th edition. - Mohammad K. Azarian, Feb 25 2008
a(n) is the number of permutations p of {1,2,...,n} with p(1)!=1 and having no right-to-left minima in consecutive positions. Example a(3) = 2 because we have 231 and 321. - Emeric Deutsch, Mar 12 2008
a(n) is the number of permutations p of {1,2,...,n} with p(n)! = n and having no left to right maxima in consecutive positions. Example a(3) = 2 because we have 312 and 321. - Emeric Deutsch, Mar 12 2008
Number of wedged (n-1)-spheres in the homotopy type of the Boolean complex of the complete graph K_n. - Bridget Tenner, Jun 04 2008
The only prime number in the sequence is 2. - Howard Berman (howard_berman(AT)hotmail.com), Nov 08 2008
From Emeric Deutsch, Apr 02 2009: (Start)
a(n) is the number of permutations of {1,2,...,n} having exactly one small ascent. A small ascent in a permutation (p_1,p_2,...,p_n) is a position i such that p_{i+1} - p_i = 1. (Example: a(3) = 2 because we have 312 and 231; see the Charalambides reference, pp. 176-180.) [See also David, Kendall and Barton, p. 263. - N. J. A. Sloane, Apr 11 2014]
a(n) is the number of permutations of {1,2,...,n} having exactly one small descent. A small descent in a permutation (p_1,p_2,...,p_n) is a position i such that p_i - p_{i+1} = 1. (Example: a(3)=2 because we have 132 and 213.) (End)
For n > 2, a(n) + a(n-1) = A000255(n-1); where A000255 = (1, 1, 3, 11, 53, ...). - Gary W. Adamson, Apr 16 2009
Connection to A002469 (game of mousetrap with n cards): A002469(n) = (n-2)*A000255(n-1) + A000166(n). (Cf. triangle A159610.) - Gary W. Adamson, Apr 17 2009
From Emeric Deutsch, Jul 18 2009: (Start)
a(n) is the sum of the values of the largest fixed points of all non-derangements of length n-1. Example: a(4)=9 because the non-derangements of length 3 are 123, 132, 213, and 321, having largest fixed points 3, 1, 3, and 2, respectively.
a(n) is the number of non-derangements of length n+1 for which the difference between the largest and smallest fixed point is 2. Example: a(3) = 2 because we have 1'43'2 and 32'14'; a(4) = 9 because we have 1'23'54, 1'43'52, 1'53'24, 52'34'1, 52'14'3, 32'54'1, 213'45', 243'15', and 413'25' (the extreme fixed points are marked).
(End)
a(n), n >= 1, is also the number of unordered necklaces with n beads, labeled differently from 1 to n, where each necklace has >= 2 beads. This produces the M2 multinomial formula involving partitions without part 1 given below. Because M2(p) counts the permutations with cycle structure given by partition p, this formula gives the number of permutations without fixed points (no 1-cycles), i.e., the derangements, hence the subfactorials with their recurrence relation and inputs. Each necklace with no beads is assumed to contribute a factor 1 in the counting, hence a(0)=1. This comment derives from a family of recurrences found by Malin Sjodahl for a combinatorial problem for certain quark and gluon diagrams (Feb 27 2010). - Wolfdieter Lang, Jun 01 2010
From Emeric Deutsch, Sep 06 2010: (Start)
a(n) is the number of permutations of {1,2,...,n, n+1} starting with 1 and having no successions. A succession in a permutation (p_1,p_2,...,p_n) is a position i such that p_{i+1} - p_i = 1. Example: a(3)=2 because we have 1324 and 1432.
a(n) is the number of permutations of {1,2,...,n} that do not start with 1 and have no successions. A succession in a permutation (p_1,p_2,...,p_n) is a position i such that p_{i+1} - p_i = 1. Example: a(3)=2 because we have 213 and 321.
(End)
Increasing colored 1-2 trees with choice of two colors for the rightmost branch of nonleave except on the leftmost path, there is no vertex of outdegree one on the leftmost path. - Wenjin Woan, May 23 2011
a(n) is the number of zeros in n-th row of the triangle in A170942, n > 0. - Reinhard Zumkeller, Mar 29 2012
a(n) is the maximal number of totally mixed Nash equilibria in games of n players, each with 2 pure options. - Raimundas Vidunas, Jan 22 2014
Convolution of sequence A135799 with the sequence generated by 1+x^2/(2*x+1). - Thomas Baruchel, Jan 08 2016
The number of interior lattice points of the subpolytope of the n-dimensional permutohedron whose vertices correspond to permutations avoiding 132 and 312. - Robert Davis, Oct 05 2016
Consider n circles of different radii, where each circle is either put inside some bigger circle or contains a smaller circle inside it (no common points are allowed). Then a(n) gives the number of such combinations. - Anton Zakharov, Oct 12 2016
If we partition the permutations of [n+1] in A000240 according to their starting digit, we will get (n+1) equinumerous classes each of size a(n), i.e., A000240(n+1) = (n+1)*a(n), hence a(n) is the size of each class of permutations of [n+1] in A000240. For example, for n = 4 we have 45 = 5*9. - Enrique Navarrete, Jan 10 2017
Call d_n1 the permutations of [n] that have the substring n1 but no substring in {12,23,...,(n-1)n}. If we partition them according to their starting digit, we will get (n-1) equinumerous classes each of size A000166(n-2) (the class starting with the digit 1 is empty since we must have the substring n1). Hence d_n1 = (n-1)*A000166(n-2) and A000166(n-2) is the size of each nonempty class in d_n1. For example, d_71 = 6*44 = 264, so there are 264 permutations in d_71 distributed in 6 nonempty classes of size A000166(5) = 44. (To get permutations in d_n1 recursively from more basic ones see the link "Forbidden Patterns" below.) - Enrique Navarrete, Jan 15 2017
Also the number of maximum matchings and minimum edge covers in the n-crown graph. - Eric W. Weisstein, Jun 14 and Dec 24 2017
The sequence a(n) taken modulo a positive integer k is periodic with exact period dividing k when k is even and dividing 2*k when k is odd. This follows from the congruence a(n+k) = (-1)^k*a(n) (mod k) for all n and k, which in turn is easily proved by induction making use of the recurrence a(n) = n*a(n-1) + (-1)^n. - Peter Bala, Nov 21 2017
a(n) is the number of distinct possible solutions for a directed, no self loop containing graph (not necessarily connected) that has n vertices, and each vertex has an in- and out-degree of exactly 1. - Patrik Holopainen, Sep 18 2018
a(n) is the dimension of the kernel of the random-to-top and random-to-random shuffling operators over a collection of n objects (in a vector space of size n!), as noticed by M. Wachs and V. Reiner. See the Reiner, Saliola and Welker reference below. - Nadia Lafreniere, Jul 18 2019
a(n) is the number of distinct permutations for a Secret Santa gift exchange with n participants. - Patrik Holopainen, Dec 30 2019
a(2*n+1) is even. More generally, a(m*n+1) is divisible by m*n, which follows from a(n+1) = n*(a(n) + a(n-1)) = n*A000255(n-1) for n >= 1. a(2*n) is odd; in fact, a(2*n) == 1 (mod 8). Other divisibility properties include a(6*n) == 1 (mod 24), a(9*n+4) == a(9*n+7) == 0 (mod 9), a(10*n) == 1 (mod 40), a(11*n+5) == 0 (mod 11) and a(13*n+8 ) == 0 (mod 13). - Peter Bala, Apr 05 2022
Conjecture: a(n) with n > 2 is a perfect power only for n = 4 with a(4) = 3^2. This has been verified for n <= 1000. - Zhi-Wei Sun, Jan 09 2025

Examples

			a(2) = 1, a(3) = 2 and a(4) = 9 since the possibilities are {BA}, {BCA, CAB} and {BADC, BCDA, BDAC, CADB, CDAB, CDBA, DABC, DCAB, DCBA}. - _Henry Bottomley_, Jan 17 2001
The Boolean complex of the complete graph K_4 is homotopy equivalent to the wedge of 9 3-spheres.
Necklace problem for n = 6: partitions without part 1 and M2 numbers for n = 6: there are A002865(6) = 4 such partitions, namely (6), (2,4), (3^2) and (2^3) in A-St order with the M2 numbers 5!, 90, 40 and 15, respectively, adding up to 265 = a(6). This corresponds to 1 necklace with 6 beads, two necklaces with 2 and 4 beads respectively, two necklaces with 3 beads each and three necklaces with 2 beads each. - _Wolfdieter Lang_, Jun 01 2010
G.f. = 1 + x^2 + 9*x^3 + 44*x^4 + 265*x^5 + 1854*x^6 + 14833*x^7 + 133496*x^8 + ...
		

References

  • U. Abel, Some new identities for derangement numbers, Fib. Q., 56:4 (2018), 313-318.
  • M. Bona, Combinatorics of Permutations, Chapman & Hall/CRC, Boca Raton, Florida, 2004.
  • Miklos Bona, editor, Handbook of Enumerative Combinatorics, CRC Press, 2015, page 32.
  • R. A. Brualdi and H. J. Ryser: Combinatorial Matrix Theory, 1992, Section 7.2, p. 202.
  • Ch. A. Charalambides, Enumerative Combinatorics, Chapman & Hall/CRC, Boca Raton, Florida, 2002.
  • L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 182.
  • Florence Nightingale David and D. E. Barton, Combinatorial Chance. Hafner, NY, 1962, p. 168.
  • Florence Nightingale David, Maurice George Kendall, and D. E. Barton, Symmetric Function and Allied Tables, Cambridge, 1966, p. 263, Table 7.5.1, row 1.
  • P. R. de Montmort, On the Game of Thirteen (1713), reprinted in Annotated Readings in the History of Statistics, ed. H. A. David and A. W. F. Edwards, Springer-Verlag, 2001, pp. 25-29.
  • J. M. de Saint-Martin, "Le problème des rencontres" in Quadrature, No. 61, pp. 14-19, 2006, EDP-Sciences Les Ulis (France).
  • H. Doerrie, 100 Great Problems of Elementary Mathematics, Dover, NY, 1965, p. 19.
  • Leonhard Euler, Solution quaestionis curiosae ex doctrina combinationum, Mémoires Académie sciences St. Pétersburg 3 (1809/1810), 57-64; also E738 in his Collected Works, series I, volume 7, pages 435-440.
  • J. M. Gandhi, On logarithmic numbers, Math. Student, 31 (1963), 73-83.
  • A. Hald, A History of Probability and Statistics and Their Applications Before 1750, Wiley, NY, 1990 (Chapter 19).
  • Irving Kaplansky, John Riordan, The problème des ménages. Scripta Math. 12 (1946), 113-124. See Eq(1).
  • Arnold Kaufmann, "Introduction à la combinatorique en vue des applications." Dunod, Paris, 1968. See p. 92.
  • Florian Kerschbaum and Orestis Terzidis, Filtering for Private Collaborative Benchmarking, in Emerging Trends in Information and Communication Security, Lecture Notes in Computer Science, Volume 3995/2006.
  • E. Lozansky and C. Rousseau, Winning Solutions, Springer, 1996; see p. 152.
  • P. A. MacMahon, Combinatory Analysis, 2 vols., Chelsea, NY, 1960, see p. 102.
  • M. S. Petković, "Non-attacking rooks", Famous Puzzles of Great Mathematicians, pp. 265-268, Amer. Math. Soc.(AMS), 2009.
  • V. Reiner, F. Saliola, and V. Welker. Spectra of Symmetrized Shuffling Operators, Memoirs of the American Mathematical Society, vol. 228, Amer. Math. Soc., Providence, RI, 2014, pp. 1-121. See section VI.9.
  • J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p. 65.
  • H. J. Ryser, Combinatorial Mathematics. Mathematical Association of America, Carus Mathematical Monograph 14, 1963, p. 23.
  • T. Simpson, Permutations with unique fixed and reflected points. Ars Combin. 39 (1995), 97-108.
  • 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).
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers. Penguin Books, NY, 1986, Revised edition 1987. See p. 122.
  • D. B. West, Combinatorial Mathematics, Cambridge, 2021, p. 82.
  • H. S. Wilf, Generatingfunctionology, Academic Press, NY, 1990, p. 147, Eq. 5.2.9 (q=1).

Crossrefs

For the probabilities a(n)/n!, see A053557/A053556 and A103816/A053556.
A diagonal of A008291 and A068106. Column A008290(n,0).
A001120 has a similar recurrence.
For other derangement numbers see also A053871, A033030, A088991, A088992.
Pairwise sums of A002741 and A000757. Differences of A001277.
A diagonal in triangles A008305 and A010027.
a(n)/n! = A053557/A053556 = (N(n, n) of A103361)/(D(n, n) of A103360).
Column k=0 of A086764 and of A334715. Column k=1 of A364068.
Row sums of A216963 and of A323671.

Programs

  • Haskell
    a000166 n = a000166_list !! n
    a000166_list = 1 : 0 : zipWith (*) [1..]
                           (zipWith (+) a000166_list $ tail a000166_list)
    -- Reinhard Zumkeller, Dec 09 2012
    
  • Magma
    I:=[0,1]; [1] cat [n le 2 select I[n] else (n-1)*(Self(n-1)+Self(n-2)): n in [1..30]]; // Vincenzo Librandi, Jan 07 2016
  • Maple
    A000166 := proc(n) option remember; if n<=1 then 1-n else (n-1)*(procname(n-1)+procname(n-2)); fi; end;
    a:=n->n!*sum((-1)^k/k!, k=0..n): seq(a(n), n=0..21); # Zerinvary Lajos, May 17 2007
    ZL1:=[S,{S=Set(Cycle(Z,card>1))},labeled]: seq(count(ZL1,size=n),n=0..21); # Zerinvary Lajos, Sep 26 2007
    with (combstruct):a:=proc(m) [ZL,{ZL=Set(Cycle(Z,card>=m))},labeled]; end: A000166:=a(2):seq(count(A000166,size=n),n=0..21); # Zerinvary Lajos, Oct 02 2007
    Z := (x, m)->m!^2*sum(x^j/((m-j)!^2), j=0..m): R := (x, n, m)->Z(x, m)^n: f := (t, n, m)->sum(coeff(R(x, n, m), x, j)*(t-1)^j*(n*m-j)!, j=0..n*m): seq(f(0, n, 1), n=0..21); # Zerinvary Lajos, Jan 22 2008
    a:=proc(n) if `mod`(n,2)=1 then sum(2*k*factorial(n)/factorial(2*k+1), k=1.. floor((1/2)*n)) else 1+sum(2*k*factorial(n)/factorial(2*k+1), k=1..floor((1/2)*n)-1) end if end proc: seq(a(n),n=0..20); # Emeric Deutsch, Feb 23 2008
    G(x):=2*exp(-x)/(1-x): f[0]:=G(x): for n from 1 to 26 do f[n]:=diff(f[n-1],x) od: x:=0: seq(f[n]/2,n=0..21); # Zerinvary Lajos, Apr 03 2009
    seq(simplify(KummerU(-n, -n, -1)), n = 0..23); # Peter Luschny, May 10 2022
  • Mathematica
    a[0] = 1; a[n_] := n*a[n - 1] + (-1)^n; a /@ Range[0, 21] (* Robert G. Wilson v *)
    a[0] = 1; a[1] = 0; a[n_] := Round[n!/E] /; n >= 1 (* Michael Taktikos, May 26 2006 *)
    Range[0, 20]! CoefficientList[ Series[ Exp[ -x]/(1 - x), {x, 0, 20}], x]
    dr[{n_,a1_,a2_}]:={n+1,a2,n(a1+a2)}; Transpose[NestList[dr,{0,0,1},30]][[3]] (* Harvey P. Dale, Feb 23 2013 *)
    a[n_] := (-1)^n HypergeometricPFQ[{- n, 1}, {}, 1]; (* Michael Somos, Jun 01 2013 *)
    a[n_] := n! SeriesCoefficient[Exp[-x] /(1 - x), {x, 0, n}]; (* Michael Somos, Jun 01 2013 *)
    Table[Subfactorial[n], {n, 0, 21}] (* Jean-François Alcover, Jan 10 2014 *)
    RecurrenceTable[{a[n] == n*a[n - 1] + (-1)^n, a[0] == 1}, a, {n, 0, 23}] (* Ray Chandler, Jul 30 2015 *)
    Subfactorial[Range[0, 20]] (* Eric W. Weisstein, Dec 31 2017 *)
    nxt[{n_,a_}]:={n+1,a(n+1)+(-1)^(n+1)}; NestList[nxt,{0,1},25][[All,2]] (* Harvey P. Dale, Jun 01 2019 *)
  • Maxima
    s[0]:1$
    s[n]:=n*s[n-1]+(-1)^n$
    makelist(s[n],n,0,12); /* Emanuele Munarini, Mar 01 2011 */
    
  • PARI
    {a(n) = if( n<1, 1, n * a(n-1) + (-1)^n)}; /* Michael Somos, Mar 24 2003 */
    
  • PARI
    {a(n) = n! * polcoeff( exp(-x + x * O(x^n)) / (1 - x), n)}; /* Michael Somos, Mar 24 2003 */
    
  • PARI
    {a(n)=polcoeff(sum(m=0,n,m^m*x^m/(1+(m+1)*x+x*O(x^n))^(m+1)),n)} /* Paul D. Hanna */
    
  • PARI
    A000166=n->n!*sum(k=0,n,(-1)^k/k!) \\ M. F. Hasler, Jan 26 2012
    
  • PARI
    a(n)=if(n,round(n!/exp(1)),1) \\ Charles R Greathouse IV, Jun 17 2012
    
  • PARI
    apply( {A000166(n)=n!\/exp(n>0)}, [0..22]) \\ M. F. Hasler, Nov 09 2024
    
  • Python
    See Hobson link.
    
  • Python
    A000166_list, m, x = [], 1, 1
    for n in range(10*2):
        x, m = x*n + m, -m
        A000166_list.append(x) # Chai Wah Wu, Nov 03 2014
    

Formula

a(n) = A008290(n,0).
a(n) + A003048(n+1) = 2*n!. - D. G. Rogers, Aug 26 2006
a(n) = {(n-1)!/exp(1)}, n > 1, where {x} is the nearest integer function. - Simon Plouffe, March 1993 [This uses offset 1, see below for the version with offset 0. - Charles R Greathouse IV, Jan 25 2012]
a(0) = 1, a(n) = round(n!/e) = floor(n!/e + 1/2) for n > 0.
a(n) = n!*Sum_{k=0..n} (-1)^k/k!.
D-finite with recurrence a(n) = (n-1)*(a(n-1) + a(n-2)), n > 0.
a(n) = n*a(n-1) + (-1)^n.
E.g.f.: exp(-x)/(1-x).
a(n) = Sum_{k=0..n} binomial(n, k)*(-1)^(n-k)*k! = Sum_{k=0..n} (-1)^(n-k)*n!/(n-k)!. - Paul Barry, Aug 26 2004
The e.g.f. y(x) satisfies y' = x*y/(1-x).
Inverse binomial transform of A000142. - Ross La Haye, Sep 21 2004
In Maple notation, representation as n-th moment of a positive function on [-1, infinity]: a(n)= int( x^n*exp(-x-1), x=-1..infinity ), n=0, 1... . a(n) is the Hamburger moment of the function exp(-1-x)*Heaviside(x+1). - Karol A. Penson, Jan 21 2005
a(n) = A001120(n) - n!. - Philippe Deléham, Sep 04 2005
a(n) = Integral_{x=0..oo} (x-1)^n*exp(-x) dx. - Gerald McGarvey, Oct 14 2006
a(n) = Sum_{k=2,4,...} T(n,k), where T(n,k) = A092582(n,k) = k*n!/(k+1)! for 1 <= k < n and T(n,n)=1. - Emeric Deutsch, Feb 23 2008
a(n) = n!/e + (-1)^n*(1/(n+2 - 1/(n+3 - 2/(n+4 - 3/(n+5 - ...))))). Asymptotic result (Ramanujan): (-1)^n*(a(n) - n!/e) ~ 1/n - 2/n^2 + 5/n^3 - 15/n^4 + ..., where the sequence [1,2,5,15,...] is the sequence of Bell numbers A000110. - Peter Bala, Jul 14 2008
From William Vaughn (wvaughn(AT)cvs.rochester.edu), Apr 13 2009: (Start)
a(n) = Integral_{p=0..1} (log(1/(1-p)) - 1)^n dp.
Proof: Using the substitutions 1=log(e) and y = e(1-p) the above integral can be converted to ((-1)^n/e) Integral_{y=0..e} (log(y))^n dy.
From CRC Integral tables we find the antiderivative of (log(y))^n is (-1)^n n! Sum_{k=0..n} (-1)^k y(log(y))^k / k!.
Using the fact that e(log(e))^r = e for any r >= 0 and 0(log(0))^r = 0 for any r >= 0 the integral becomes n! * Sum_{k=0..n} (-1)^k / k!, which is line 9 of the Formula section. (End)
a(n) = exp(-1)*Gamma(n+1,-1) (incomplete Gamma function). - Mark van Hoeij, Nov 11 2009
G.f.: 1/(1-x^2/(1-2x-4x^2/(1-4x-9x^2/(1-6x-16x^2/(1-8x-25x^2/(1-... (continued fraction). - Paul Barry, Nov 27 2009
a(n) = Sum_{p in Pano1(n)} M2(p), n >= 1, with Pano1(n) the set of partitions without part 1, and the multinomial M2 numbers. See the characteristic array for partitions without part 1 given by A145573 in Abramowitz-Stegun (A-S) order, with A002865(n) the total number of such partitions. The M2 numbers are given for each partition in A-St order by the array A036039. - Wolfdieter Lang, Jun 01 2010
a(n) = row sum of A008306(n), n > 1. - Gary Detlefs, Jul 14 2010
a(n) = ((-1)^n)*(n-1)*hypergeom([-n+2, 2], [], 1), n>=1; 1 for n=0. - Wolfdieter Lang, Aug 16 2010
a(n) = (-1)^n * hypergeom([ -n, 1], [], 1), n>=1; 1 for n=0. From the binomial convolution due to the e.g.f. - Wolfdieter Lang, Aug 26 2010
Integral_{x=0..1} x^n*exp(x) = (-1)^n*(a(n)*e - n!).
O.g.f.: Sum_{n>=0} n^n*x^n/(1 + (n+1)*x)^(n+1). - Paul D. Hanna, Oct 06 2011
Abs((a(n) + a(n-1))*e - (A000142(n) + A000142(n-1))) < 2/n. - Seiichi Kirikami, Oct 17 2011
G.f.: hypergeom([1,1],[],x/(x+1))/(x+1). - Mark van Hoeij, Nov 07 2011
From Sergei N. Gladkovskii, Nov 25 2011, Jul 05 2012, Sep 23 2012, Oct 13 2012, Mar 09 2013, Mar 10 2013, Oct 18 2013: (Start)
Continued fractions:
In general, e.g.f. (1+a*x)/exp(b*x) = U(0) with U(k) = 1 + a*x/(1-b/(b-a*(k+1)/U(k+1))). For a=-1, b=-1: exp(-x)/(1-x) = 1/U(0).
E.g.f.: (1-x/(U(0)+x))/(1-x), where U(k) = k+1 - x + (k+1)*x/U(k+1).
E.g.f.: 1/Q(0) where Q(k) = 1 - x/(1 - 1/(1 - (k+1)/Q(k+1))).
G.f.: 1/U(0) where U(k) = 1 + x - x*(k+1)/(1 - x*(k+1)/U(k+1)).
G.f.: Q(0)/(1+x) where Q(k) = 1 + (2*k+1)*x/((1+x)-2*x*(1+x)*(k+1)/(2*x*(k+1)+(1+x)/ Q(k+1))).
G.f.: 1/Q(0) where Q(k) = 1 - 2*k*x - x^2*(k + 1)^2/Q(k+1).
G.f.: T(0) where T(k) = 1 - x^2*(k+1)^2/(x^2*(k+1)^2-(1-2*x*k)*(1-2*x-2*x*k)/T(k+1)). (End)
0 = a(n)*(a(n+1) + a(n+2) - a(n+3)) + a(n+1)*(a(n+1) + 2*a(n+2) - a(n+3)) + a(n+2)*a(n+2) if n>=0. - Michael Somos, Jan 25 2014
a(n) = Sum_{k = 0..n} (-1)^(n-k)*binomial(n,k)*(k + x)^k*(k + x + 1)^(n-k) = Sum_{k = 0..n} (-1)^(n-k)*binomial(n,k)*(k + x)^(n-k)*(k + x - 1)^k, for arbitrary x. - Peter Bala, Feb 19 2017
From Peter Luschny, Jun 20 2017: (Start)
a(n) = Sum_{j=0..n} Sum_{k=0..n} binomial(-j-1, -n-1)*abs(Stirling1(j, k)).
a(n) = Sum_{k=0..n} (-1)^(n-k)*Pochhammer(n-k+1, k) (cf. A008279). (End)
a(n) = n! - Sum_{j=0..n-1} binomial(n,j) * a(j). - Alois P. Heinz, Jan 23 2019
Sum_{n>=2} 1/a(n) = A281682. - Amiram Eldar, Nov 09 2020
a(n) = KummerU(-n, -n, -1). - Peter Luschny, May 10 2022
a(n) = (-1)^n*Sum_{k=0..n} Bell(k)*Stirling1(n+1, k+1). - Mélika Tebni, Jul 05 2022

Extensions

Minor edits by M. F. Hasler, Jan 16 2017

A000522 Total number of ordered k-tuples (k=0..n) of distinct elements from an n-element set: a(n) = Sum_{k=0..n} n!/k!.

Original entry on oeis.org

1, 2, 5, 16, 65, 326, 1957, 13700, 109601, 986410, 9864101, 108505112, 1302061345, 16926797486, 236975164805, 3554627472076, 56874039553217, 966858672404690, 17403456103284421, 330665665962404000, 6613313319248080001, 138879579704209680022, 3055350753492612960485, 70273067330330098091156
Offset: 0

Views

Author

Keywords

Comments

Total number of permutations of all subsets of an n-set.
Also the number of one-to-one sequences that can be formed from n distinct objects.
Old name "Total number of permutations of a set with n elements", or the same with the word "arrangements", both sound too much like A000142.
Related to number of operations of addition and multiplication to evaluate a determinant of order n by cofactor expansion - see A026243.
a(n) is also the number of paths (without loops) in the complete graph on n+2 vertices starting at one vertex v1 and ending at another v2. Example: when n=2 there are 5 paths in the complete graph with 4 vertices starting at the vertex 1 and ending at the vertex 2: (12),(132),(142),(1342),(1432) so a(2) = 5. - Avi Peretz (njk(AT)netvision.net.il), Feb 23 2001; comment corrected by Jonathan Coxhead, Mar 21 2003
Also row sums of Table A008279, which can be generated by taking the derivatives of x^k. For example, for y = 1*x^3, y' = 3x^2, y" = 6x, y'''= 6 so a(4) = 1 + 3 + 6 + 6 = 16. - Alford Arnold, Dec 15 1999
a(n) is the permanent of the n X n matrix with 2s on the diagonal and 1s elsewhere. - Yuval Dekel, Nov 01 2003
(A000166 + this_sequence)/2 = A009179, (A000166 - this_sequence)/2 = A009628.
Stirling transform of A006252(n-1) = [1,1,1,2,4,14,38,...] is a(n-1) = [1,2,5,16,65,...]. - Michael Somos, Mar 04 2004
Number of {12,12*,21*}- and {12,12*,2*1}-avoiding signed permutations in the hyperoctahedral group.
a(n) = b such that Integral_{x=0..1} x^n*exp(-x) dx = a-b*exp(-1). - Sébastien Dumortier, Mar 05 2005
a(n) is the number of permutations on [n+1] whose left-to-right record lows all occur at the start. Example: a(2) counts all permutations on [3] except 231 (the last entry is a record low but its predecessor is not). - David Callan, Jul 20 2005
a(n) is the number of permutations on [n+1] that avoid the (scattered) pattern 1-2-3|. The vertical bar means the "3" must occur at the end of the permutation. For example, 21354 is not counted by a(4): 234 is an offending subpermutation. - David Callan, Nov 02 2005
Number of deco polyominoes of height n+1 having no reentrant corners along the lower contour (i.e., no vertical step that is followed by a horizontal step). In other words, a(n)=A121579(n+1,0). A deco polyomino is a directed column-convex polyomino in which the height, measured along the diagonal, is attained only in the last column. Example: a(1)=2 because the only deco polyominoes of height 2 are the vertical and horizontal dominoes, having no reentrant corners along their lower contours. - Emeric Deutsch, Aug 16 2006
Unreduced numerators of partial sums of the Taylor series for e. - Jonathan Sondow, Aug 18 2006
a(n) is the number of permutations on [n+1] (written in one-line notation) for which the subsequence beginning at 1 is increasing. Example: a(2)=5 counts 123, 213, 231, 312, 321. - David Callan, Oct 06 2006
a(n) is the number of permutations (written in one-line notation) on the set [n + k], k >= 1, for which the subsequence beginning at 1,2,...,k is increasing. Example: n = 2, k = 2. a(2) = 5 counts 1234, 3124, 3412, 4123, 4312. - Peter Bala, Jul 29 2014
a(n) and (1,-2,3,-4,5,-6,7,...) form a reciprocal pair under the list partition transform and associated operations described in A133314. - Tom Copeland, Nov 01 2007
Consider the subsets of the set {1,2,3,...,n} formed by the first n integers. E.g., for n = 3 we have {}, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}. Let the variable sbst denote a subset. For each subset sbst we determine its number of parts, that is nprts(sbst). The sum over all possible subsets is written as Sum_{sbst=subsets}. Then a(n) = Sum_{sbst=subsets} nprts(sbst)!. E.g., for n = 3 we have 1!+1!+1!+1!+2!+2!+2!+3!=16. - Thomas Wieder, Jun 17 2006
Equals row sums of triangle A158359(unsigned). - Gary W. Adamson, Mar 17 2009
Equals eigensequence of triangle A158821. - Gary W. Adamson, Mar 30 2009
For positive n, equals 1/BarnesG(n+1) times the determinant of the n X n matrix whose (i,j)-coefficient is the (i+j)th Bell number. - John M. Campbell, Oct 03 2011
a(n) is the number of n X n binary matrices with i) at most one 1 in each row and column and ii) the subset of rows that contain a 1 must also be the columns that contain a 1. Cf. A002720 where restriction ii is removed. - Geoffrey Critzer, Dec 20 2011
Number of restricted growth strings (RGS) [d(1),d(2),...,d(n)] such that d(k) <= k and d(k) <= 1 + (number of nonzero digits in prefix). The positions of nonzero digits determine the subset, and their values (decreased by 1) are the (left) inversion table (a rising factorial number) for the permutation, see example. - Joerg Arndt, Dec 09 2012
Number of a restricted growth strings (RGS) [d(0), d(1), d(2), ..., d(n)] where d(k) >= 0 and d(k) <= 1 + chg([d(0), d(1), d(2), ..., d(k-1)]) and chg(.) gives the number of changes of its argument. Replacing the function chg(.) by a function asc(.) that counts the ascents in the prefix gives A022493 (ascent sequences). - Joerg Arndt, May 10 2013
The sequence t(n) = number of i <= n such that floor(e*i!) is a square is mentioned in the abstract of Luca & Shparlinski. The values are t(n) = 0 for 0 <= n <= 2 and t(n) = 1 for at least 3 <= n <= 300. - R. J. Mathar, Jan 16 2014
a(n) = p(n,1) = q(n,1), where p and q are polynomials defined at A248664 and A248669. - Clark Kimberling, Oct 11 2014
a(n) is the number of ways at most n people can queue up at a (slow) ticket counter when one or more of the people may choose not to queue up. Note that there are C(n,k) sets of k people who quene up and k! ways to queue up. Since k can run from 0 to n, a(n) = Sum_{k=0..n} n!/(n-k)! = Sum_{k=0..n} n!/k!. For example, if n=3 and the people are A(dam), B(eth), and C(arl), a(3)=16 since there are 16 possible lineups: ABC, ACB, BAC, BCA, CAB, CBA, AB, BA, AC, CA, BC, CB, A, B, C, and empty queue. - Dennis P. Walsh, Oct 02 2015
As the row sums of A008279, Motzkin uses the abbreviated notation $n_<^\Sigma$ for a(n).
The piecewise polynomial function f defined by f(x) = a(n)*x^n/n! on each interval [ 1-1/a(n), 1-1/a(n+1) ) is continuous on [0,1) and lim_{x->1} f(x) = e. - Luc Rousseau, Oct 15 2019
a(n) is composite for 3 <= n <= 2015, but a(2016) is prime (or at least a strong pseudoprime): see Johansson link. - Robert Israel, Jul 27 2020 [a(2016) is prime, ECPP certificate generated with CM 0.4.3 and checked by factordb. - Jason H Parker, Jun 15 2025]
In general, sequences of the form a(0)=a, a(n) = n*a(n-1) + k, n>0, will have a closed form of n!*a + floor(n!*(e-1))*k. - Gary Detlefs, Oct 26 2020
From Peter Bala, Apr 03 2022: (Start)
a(2*n) is odd and a(2*n+1) is even. More generally, a(n+k) == a(n) (mod k) for all n and k. It follows that for each positive integer k, the sequence obtained by reducing a(n) modulo k is periodic, with the exact period dividing k. Various divisibility properties of the sequence follow from this; for example, a(5*n+2) == a(5*n+4) == 0 (mod 5), a(25*n+7) == a(25*n+19) == 0 (mod 25) and a(13*n+4) == a(13*n+10)== a(13*n+12) == 0 (mod 13). (End)
Number of possible ranking options on a typical ranked choice voting ballot with n candidates (allowing undervotes). - P. Christopher Staecker, May 05 2024
From Thomas Scheuerle, Dec 28 2024: (Start)
Number of decorated permutations of size n.
Number of Le-diagrams with bounding box semiperimeter n, for n > 0.
By counting over all k = 1..n and n > 0, the number of positroid cells for the totally nonnegative real Grassmannian Gr(k, n), equivalently the number of Grassmann necklaces of type (k, n). (End)

Examples

			G.f. = 1 + 2*x + 5*x^2 + 16*x^3 + 65*x^4 + 326*x^5 + 1957*x^6 + 13700*x^7 + ...
With two objects we can form 5 sequences: (), (a), (b), (a,b), (b,a), so a(2) = 5.
From _Joerg Arndt_, Dec 09 2012: (Start)
The 16 arrangements of the 3-set and their RGS (dots denote zeros) are
  [ #]       RGS        perm. of subset
  [ 1]    [ . . . ]      [  ]
  [ 2]    [ . . 1 ]      [ 3 ]
  [ 3]    [ . 1 . ]      [ 2 ]
  [ 4]    [ . 1 1 ]      [ 2 3 ]
  [ 5]    [ . 1 2 ]      [ 3 2 ]
  [ 6]    [ 1 . . ]      [ 1 ]
  [ 7]    [ 1 . 1 ]      [ 1 3 ]
  [ 8]    [ 1 . 2 ]      [ 3 1 ]
  [ 9]    [ 1 1 . ]      [ 1 2 ]
  [10]    [ 1 1 1 ]      [ 1 2 3 ]
  [11]    [ 1 1 2 ]      [ 1 3 2 ]
  [12]    [ 1 1 3 ]      [ 2 3 1 ]
  [13]    [ 1 2 . ]      [ 2 1 ]
  [14]    [ 1 2 1 ]      [ 2 1 3 ]
  [15]    [ 1 2 2 ]      [ 3 1 2 ]
  [16]    [ 1 2 3 ]      [ 3 2 1 ]
(End)
		

References

  • L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 75, Problem 9.
  • J.-M. De Koninck, Ces nombres qui nous fascinent, Entry 65, p. 23, Ellipses, Paris 2008.
  • J. M. Gandhi, On logarithmic numbers, Math. Student, 31 (1963), 73-83.
  • R. K. Guy, Unsolved Problems in Number Theory, Springer, 1st edition, 1981. See section E11.
  • J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p. 16.
  • D. Singh, The numbers L(m,n) and their relations with prepared Bernoulli and Eulerian numbers, Math. Student, 20 (1952), 66-70.
  • 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

Average of n-th row of triangle in A068424 [Corrected by N. J. A. Sloane, Feb 29 2024].
Row sums of A008279 and A094816.
First differences give A001339. Second differences give A001340.
Partial sums are in A001338, A002104.
A row of the array in A144502.
See also A370973, Nearest integer to e*n!.

Programs

  • Haskell
    import Data.List (subsequences, permutations)
    a000522 = length . choices . enumFromTo 1 where
    choices = concat . map permutations . subsequences
    -- Reinhard Zumkeller, Feb 21 2012, Oct 25 2010
    
  • Magma
    [1] cat [n eq 1 select (n+1) else n*Self(n-1)+1: n in [1..25]]; // Vincenzo Librandi, Feb 15 2015
    
  • Maple
    a(n):= exp(1)*int(x^n*exp(-x)*Heaviside(x-1), x=0..infinity); # Karol A. Penson, Oct 01 2001
    A000522 := n->add(n!/k!,k=0..n);
    G(x):=exp(x)/(1-x): f[0]:=G(x): for n from 1 to 26 do f[n]:=diff(f[n-1],x) od: x:=0: seq(f[n],n=0..20);
    # Zerinvary Lajos, Apr 03 2009
    G:=exp(z)/(1-z): Gser:=series(G,z=0,21):
    for n from 0 to 20 do a(n):=n!*coeff(Gser,z,n): end do
    # Paul Weisenhorn, May 30 2010
    k := 1; series(hypergeom([1,k],[],x/(1-x))/(1-x), x=0, 20); # Mark van Hoeij, Nov 07 2011
    # one more Maple program:
    a:= proc(n) option remember;
          `if`(n<0, 0, 1+n*a(n-1))
        end:
    seq(a(n), n=0..23);  # Alois P. Heinz, Sep 13 2019
    seq(simplify(KummerU(-n, -n, 1)), n = 0..23); # Peter Luschny, May 10 2022
  • Mathematica
    Table[FunctionExpand[Gamma[n + 1, 1]*E], {n, 0, 24}]
    nn = 20; Accumulate[Table[1/k!, {k, 0, nn}]] Range[0, nn]! (* Jan Mangaldan, Apr 21 2013 *)
    FoldList[#1*#2 + #2 &, 0, Range@ 23] + 1 (* or *)
    f[n_] := Floor[E*n!]; f[0] = 1; Array[f, 20, 0] (* Robert G. Wilson v, Feb 13 2015 *)
    RecurrenceTable[{a[n + 1] == (n + 1) a[n] + 1, a[0] == 1}, a, {n, 0, 12}] (* Emanuele Munarini, Apr 27 2017 *)
    nxt[{n_,a_}]:={n+1,a(n+1)+1}; NestList[nxt,{0,1},30][[All,2]] (* Harvey P. Dale, Jan 29 2023 *)
  • Maxima
    a(n) := if n=0 then 1 else n*a(n-1)+1; makelist(a(n),n,0,12); /* Emanuele Munarini, Apr 27 2017 */
  • PARI
    {a(n) = local(A); if( n<0, 0, A = vector(n+1); A[1]=1; for(k=1, n, A[k+1] = k*A[k] + 1); A[n+1])}; /* Michael Somos, Jul 01 2004 */
    
  • PARI
    {a(n) = if( n<0, 0, n! * polcoeff( exp( x +x * O(x^n)) / (1 - x), n))}; /* Michael Somos, Mar 06 2004 */
    
  • PARI
    a(n)=local(A=1+x+x*O(x^n)); for(i=1, n, A=1/(1-x)^2+x^2*deriv(A)/(1-x)); polcoeff(A, n) \\ Paul D. Hanna, Sep 03 2008
    
  • PARI
    {a(n)=local(X=x+x*O(x^n));polcoeff(sum(m=0,n,(m+2)^m*x^m/(1+(m+1)*X)^(m+1)),n)} /* Paul D. Hanna */
    
  • PARI
    a(n)=sum(k=0,n,binomial(n,k)*k!); \\ Joerg Arndt, Dec 14 2014
    
  • Sage
    # program adapted from Alois P. Heinz's Maple code in A022493
    @CachedFunction
    def b(n, i, t):
        if n <= 1:
            return 1
        return sum(b(n - 1, j, t + (j == i)) for j in range(t + 2))
    def a(n):
        return b(n, 0, 0)
    v000522 = [a(n) for n in range(33)]
    print(v000522)
    # Joerg Arndt, May 11 2013
    

Formula

a(n) = n*a(n-1) + 1, a(0) = 1.
a(n) = A007526(n-1) + 1.
a(n) = A061354(n)*A093101(n).
a(n) = n! * Sum_{k=0..n} 1/k! = n! * (e - Sum_{k>=n+1} 1/k!). - Michael Somos, Mar 26 1999
a(0) = 1; for n > 0, a(n) = floor(e*n!).
E.g.f.: exp(x)/(1-x).
a(n) = 1 + Sum_{n>=k>=j>=0} (k-j+1)*k!/j! = a(n-1) + A001339(n-1) = A007526(n) + 1. Binomial transformation of n!, i.e., A000142. - Henry Bottomley, Jun 04 2001
a(n) = floor(2/(n+1))*A009578(n+1)-1. - Emeric Deutsch, Oct 24 2001
Integral representation as n-th moment of a nonnegative function on a positive half-axis: a(n) = e*Integral_{x>=0} x^n*e^(-x)*Heaviside(x-1) dx. - Karol A. Penson, Oct 01 2001
Formula, in Mathematica notation: Special values of Laguerre polynomials, a(n)=(-1)^n*n!*LaguerreL[n, -1-n, 1], n=1, 2, ... . This relation cannot be checked by Maple, as it appears that Maple does not incorporate Laguerre polynomials with second index equal to negative integers. It does check with Mathematica. - Karol A. Penson and Pawel Blasiak ( blasiak(AT)lptl.jussieu.fr), Feb 13 2004
G.f.: Sum_{k>=0} k!*x^k/(1-x)^(k+1). a(n) = Sum_{k=0..n} (-1)^(n-k)*binomial(n, k)*k^(n-k)*(k+1)^k. - Vladeta Jovovic, Aug 18 2002
a(n) = Sum_{k=0..n} A008290(n, k)*2^k. - Philippe Deléham, Dec 12 2003
a(n) = Sum_{k=0..n} A046716(n, k). - Philippe Deléham, Jun 12 2004
a(n) = e*Gamma(n+1,1) where Gamma(z,t) = Integral_{x>=t} e^(-x)*x^(z-1) dx is incomplete gamma function. - Michael Somos, Jul 01 2004
a(n) = Sum_{k=0..n} P(n, k). - Ross La Haye, Aug 28 2005
Given g.f. A(x), then g.f. A059115 = A(x/(1-x)). - Michael Somos, Aug 03 2006
a(n) = 1 + n + n*(n-1) + n*(n-1)*(n-2) + ... + n!. - Jonathan Sondow, Aug 18 2006
a(n) = Sum_{k=0..n} binomial(n,k) * k!; interpretation: for all k-subsets (sum), choose a subset (binomial(n,k)), and permutation of subset (k!). - Joerg Arndt, Dec 09 2012
a(n) = Integral_{x>=0} (x+1)^n*e^(-x) dx. - Gerald McGarvey, Oct 19 2006
a(n) = Sum_{k=0..n} A094816(n, k), n>=0 (row sums of Poisson-Charlier coefficient matrix). - N. J. A. Sloane, Nov 10 2007
From Tom Copeland, Nov 01 2007, Dec 10 2007: (Start)
Act on 1/(1-x) with 1/(1-xDx) = Sum_{j>=0} (xDx)^j = Sum_{j>=0} x^j*D^j*x^j = Sum_{j>=0} j!*x^j*L(j,-:xD:,0) where Lag(n,x,0) are the Laguerre polynomials of order 0, D the derivative w.r.t. x and (:xD:)^j = x^j*D^j. Truncating the operator series at the j = n term gives an o.g.f. for a(0) through a(n) consistent with Jovovic's.
These results and those of Penson and Blasiak, Arnold, Bottomley and Deleham are related by the operator A094587 (the reverse of A008279), which is the umbral equivalent of n!*Lag[n,(.)!*Lag[.,x,-1],0] = (1-D)^(-1) x^n = (-1)^n * n! Lag(n,x,-1-n) = Sum_{j=0..n} binomial(n,j)*j!*x^(n-j) = Sum_{j=0..n} (n!/j!)*x^j. Umbral substitution of b(.) for x and then letting b(n)=1 for all n connects the results. See A132013 (the inverse of A094587) for a connection between these operations and 1/(1-xDx).
(End)
From Peter Bala, Jul 15 2008: (Start)
a(n) = n!*e - 1/(n + 1/(n+1 + 2/(n+2 + 3/(n+3 + ...)))).
Asymptotic result (Ramanujan): n!*e - a(n) ~ 1/n - 1/n^3 + 1/n^4 + 2/n^5 - 9/n^6 + ..., where the sequence [1,0,-1,1,2,-9,...] = [(-1)^k*A000587(k)], for k>=1.
a(n) is a difference divisibility sequence, that is, the difference a(n) - a(m) is divisible by n - m for all n and m (provided n is not equal to m). For fixed k, define the derived sequence a_k(n) = (a(n+k)-a(k))/n, n = 1,2,3,... . Then a_k(n) is also a difference divisibility sequence.
For example, the derived sequence a_0(n) is just a(n-1). The set of integer sequences satisfying the difference divisibility property forms a ring with term-wise operations of addition and multiplication.
Recurrence relations: a(0) = 1, a(n) = (n-1)*(a(n-1) + a(n-2)) + 2, for n >= 1. a(0) = 1, a(1) = 2, D-finite with recurrence: a(n) = (n+1)*a(n-1) - (n-1)*a(n-2) for n >= 2. The sequence b(n) := n! satisfies the latter recurrence with the initial conditions b(0) = 1, b(1) = 1. This leads to the finite continued fraction expansion a(n)/n! = 1/(1-1/(2-1/(3-2/(4-...-(n-1)/(n+1))))), n >= 2.
Limit_{n->oo} a(n)/n! = e = 1/(1-1/(2-1/(3-2/(4-...-n/((n+2)-...))))). This is the particular case m = 0 of the general result m!/e - d_m = (-1)^(m+1) *(1/(m+2 -1/(m+3 -2/(m+4 -3/(m+5 -...))))), where d_m denotes the m-th derangement number A000166(m).
For sequences satisfying the more general recurrence a(n) = (n+1+r)*a(n-1) - (n-1)*a(n-2), which yield series acceleration formulas for e/r! that involve the Poisson-Charlier polynomials c_r(-n;-1), refer to A001339 (r=1), A082030 (r=2), A095000 (r=3) and A095177 (r=4).
For the corresponding results for the constants log(2), zeta(2) and zeta(3) refer to A142992, A108625 and A143007 respectively.
(End)
G.f. satisfies: A(x) = 1/(1-x)^2 + x^2*A'(x)/(1-x). - Paul D. Hanna, Sep 03 2008
From Paul Barry, Nov 27 2009: (Start)
G.f.: 1/(1-2*x-x^2/(1-4*x-4*x^2/(1-6*x-9*x^2/(1-8*x-16*x^2/(1-10*x-25*x^2/(1-... (continued fraction);
G.f.: 1/(1-x-x/(1-x/(1-x-2*x/(1-2*x/(1-x-3*x/(1-3*x/(1-x-4*x/(1-4*x/(1-x-5*x/(1-5*x/(1-... (continued fraction).
(End)
O.g.f.: Sum_{n>=0} (n+2)^n*x^n/(1 + (n+1)*x)^(n+1). - Paul D. Hanna, Sep 19 2011
G.f. hypergeom([1,k],[],x/(1-x))/(1-x), for k=1,2,...,9 is the generating function for A000522, A001339, A082030, A095000, A095177, A096307, A096341, A095722, and A095740. - Mark van Hoeij, Nov 07 2011
G.f.: 1/U(0) where U(k) = 1 - x - x*(k+1)/(1 - x*(k+1)/U(k+1)); (continued fraction). - Sergei N. Gladkovskii, Oct 14 2012
E.g.f.: 1/U(0) where U(k) = 1 - x/(1 - 1/(1 + (k+1)/U(k+1))); (continued fraction). - Sergei N. Gladkovskii, Nov 16 2012
G.f.: 1/(1-x)/Q(0), where Q(k) = 1 - x/(1-x)*(k+1)/(1 - x/(1-x)*(k+1)/Q(k+1)); (continued fraction). - Sergei N. Gladkovskii, May 19 2013
G.f.: 2/(1-x)/G(0), where G(k) = 1 + 1/(1 - x*(2*k+2)/(x*(2*k+3) - 1 + x*(2*k+2)/G(k+1))); (continued fraction). - Sergei N. Gladkovskii, May 31 2013
G.f.: (B(x)+ 1)/(2-2*x) = Q(0)/(2-2*x), where B(x) be g.f. A006183, Q(k) = 1 + 1/(1 - x*(k+1)/(x*(k+1) + (1-x)/Q(k+1) )); (continued fraction). - Sergei N. Gladkovskii, Aug 08 2013
G.f.: 1/Q(0), where Q(k) = 1 - 2*x*(k+1) - x^2*(k+1)^2/Q(k+1); (continued fraction). - Sergei N. Gladkovskii, Sep 30 2013
E.g.f.: e^x/(1-x) = (1 - 12*x/(Q(0) + 6*x - 3*x^2))/(1-x), where Q(k) = 2*(4*k+1)*(32*k^2 + 16*k + x^2 - 6) - x^4*(4*k-1)*(4*k+7)/Q(k+1); (continued fraction). - Sergei N. Gladkovskii, Nov 18 2013
G.f.: conjecture: T(0)/(1-2*x), where T(k) = 1 - x^2*(k+1)^2/(x^2*(k+1)^2 - (1 - 2*x*(k+1))*(1 - 2*x*(k+2))/T(k+1) ); (continued fraction). - Sergei N. Gladkovskii, Nov 18 2013
0 = a(n)*(+a(n+1) - 3*a(n+2) + a(n+3)) + a(n+1)*(+a(n+1) - a(n+3)) + a(n+2)*(+a(n+2)) for all n>=0. - Michael Somos, Jul 04 2014
From Peter Bala, Jul 29 2014: (Start)
a(n) = F(n), where the function F(x) := Integral_{0..infinity} e^(-u)*(1 + u)^x du smoothly interpolates this sequence to all real values of x. Note that F(-1) = G and for n = 2,3,... we have F(-n) = (-1)^n/(n-1)! *( A058006(n-2) - G ), where G = 0.5963473623... denotes Gompertz's constant - see A073003.
a(n) = n!*e - e*( Sum_{k >= 0} (-1)^k/((n + k + 1)*k!) ).
(End)
a(n) = hypergeometric_U(1, n+2, 1). - Peter Luschny, Nov 26 2014
a(n) ~ exp(1-n)*n^(n-1/2)*sqrt(2*Pi). - Vladimir Reshetnikov, Oct 27 2015
a(n) = A038155(n+2)/A000217(n+1). - Anton Zakharov, Sep 08 2016
a(n) = round(exp(1)*n!), n > 1 - Simon Plouffe, Jul 28 2020
a(n) = KummerU(-n, -n, 1). - Peter Luschny, May 10 2022
a(n) = (e/(2*Pi))*Integral_{x=-oo..oo} (n+1+i*x)!/(1+i*x) dx. - David Ulgenes, Apr 18 2023
Sum_{i=0..n} (-1)^(n-i) * binomial(n, i) * a(i) = n!. - Werner Schulte, Apr 03 2024

Extensions

Additional comments from Michael Somos

A036039 Irregular triangle of multinomial coefficients of integer partitions read by rows (in Abramowitz and Stegun ordering) giving the coefficients of the cycle index polynomials for the symmetric groups S_n.

Original entry on oeis.org

1, 1, 1, 2, 3, 1, 6, 8, 3, 6, 1, 24, 30, 20, 20, 15, 10, 1, 120, 144, 90, 40, 90, 120, 15, 40, 45, 15, 1, 720, 840, 504, 420, 504, 630, 280, 210, 210, 420, 105, 70, 105, 21, 1, 5040, 5760, 3360, 2688, 1260, 3360, 4032, 3360, 1260, 1120, 1344, 2520, 1120, 1680, 105, 420, 1120, 420, 112, 210, 28, 1
Offset: 1

Views

Author

Keywords

Comments

The sequence of row lengths is A000041(n), n >= 1 (partition numbers).
Number of permutations whose cycle structure is the given partition. Row sums are factorials (A000142). - Franklin T. Adams-Watters, Jan 12 2006
A relation between partition polynomials formed from these "refined" Stirling numbers of the first kind and umbral operator trees and Lagrange inversion is presented in the link "Lagrange a la Lah".
These cycle index polynomials for the symmetric group S_n are also related to a raising operator / infinitesimal generator for fractional integro-derivatives, involving the digamma function and the Riemann zeta function values at positive integers, and to the characteristic polynomial for the adjacency matrix of complete n-graphs A055137 (cf. MathOverflow link). - Tom Copeland, Nov 03 2012
In the Lang link, replace all x(n) by t to obtain A132393. Furthermore replace x(1) by t and all other x(n) by 1 to obtain A008290. See A274760. - Tom Copeland, Nov 06 2012, Oct 29 2015 - corrected by Johannes W. Meijer, Jul 28 2016
The umbral compositional inverses of these polynomials are formed by negating the indeterminates x(n) for n>1, i.e., P(n,P(.,x(1),-x(2),-x(3),...),x(2),x(3),...) = x(1)^n (cf. A130561 for an example of umbral compositional inversion). The polynomials are an Appell sequence in x(1), i.e., dP(n,x(1))/dx(1) = n P(n-1, x(1)) and (P(.,x)+y)^n=P(n,x+y) umbrally, with P(0,x(1))=1. - Tom Copeland, Nov 14 2014
Regarded as the coefficients of the partition polynomials listed by Lang, a signed version of these polynomials IF(n,b1,b2,...,bn) (n! times polynomial on page 184 of Airault and Bouali) provides an inversion of the Faber polynomials F(n,b1,b2,...,bn) (page 52 of Bouali, A263916, and A115131). For example, F(3, IF(1,b1), IF(2,b1,b2)/2!, IF(3,b1,b2,b3)/3!) = b3 and IF(3, F(1,b1), F(2,b1,b2), F(3,b1,b2,b3))/3! = b3 with F(1,b1) = -b1. (Compare with A263634.) - Tom Copeland, Oct 28 2015; Sep 09 2016
The e.g.f. for the row partition polynomials is Sum_{n>=0} P_n(b_1,...,b_n) x^n/n! = exp[Sum_{n>=1} b_n x^n/n], or, exp[P.(b_1,...,b_n)x] = exp[-], expressed umbrally with <"power series"> denoting umbral evaluation (b.)^n = b_n within the power series. This e.g.f. is central to the paper by Maxim and Schuermannn on characteristic classes (cf. Friedrich and McKay also). - Tom Copeland, Nov 11 2015
The elementary Schur polynomials are given by S(n,x(1),x(2),...,x(n)) = P(n,x(1), 2*x(2),...,n*x(n)) / n!. See p. 12 of Carrell. - Tom Copeland, Feb 06 2016
These partition polynomials are also related to the Casimir invariants associated to quantum density states on p. 3 of Boya and Dixit and pp. 5 and 6 of Byrd and Khaneja. - Tom Copeland, Jul 24 2017
With the indeterminates (x_1,x_2,x_3,...) = (t,-c_2*t,-c_3*t,...) with c_n >0, umbrally P(n,a.) = P(n,t)|{t^n = a_n} = 0 and P(j,a.)P(k,a.) = P(j,t)P(k,t)|{t^n =a_n} = d_{j,k} >= 0 is the coefficient of x^j/j!*y^k/k! in the Taylor series expansion of the formal group law FGL(x,y) = f[f^{-1}(x)+f^{-1}(y)], where a_n are the inversion partition polynomials for calculating f(x) from the coefficients of the series expansion of f^{-1}(x) given in A133932. - Tom Copeland, Feb 09 2018
For relation to the Witt symmetric functions, as well as the basic power, elementary, and complete symmetric functions, see the Borger link p. 295. For relations to diverse zeta functions, determinants, and paths on graphs, see the MathOverflow question Cycling Through the Zeta Garden. - Tom Copeland, Mar 25 2018
Chmutov et al. identify the partition polynomials of this entry with the one-part Schur polynomials and assert that any linear combination with constant coefficients of these polynomials is a tau function for the KP hierarchy. - Tom Copeland, Apr 05 2018
With the indeterminates in the partition polynomials assigned as generalized harmonic numbers, i.e., as partial sums of the Dirichlet series for the Riemann zeta function, zeta(n), for integer n > 1, sums of simple normalizations of these polynomials give either unity or simple sums of consecutive zeta(n) (cf. Hoffman). Other identities involving these polynomials can be found in the Choi reference in Hoffman's paper. - Tom Copeland, Oct 05 2019
On p. 39 of Ma Luo's thesis is the e.g.f. of rational functions r_n obtained through the (umbral) formula 1/(1-r.T) = exp[log(1+P.T)], a differently signed e.g.f. of this entry, where (P.)^n = P_n are Eisenstein elliptic functions. P. 38 gives the example of 4! * r_4 as the signed 4th row partition polynomial of this entry. This series is equated through a simple proportionality factor to the Zagier Jacobi form on p. 25. Recurrence relations for the P_n are given on p. 24 involving the normalized k-weight Eisenstein series G_k introduced on p. 23 and related to the Bernoulli numbers. - Tom Copeland, Oct 16 2019
The Chern characteristic classes or forms of complex vector bundles and the characteristic polynomials of curvature forms for a smooth manifold can be expressed in terms of this entry's partition polynomials with the associated traces, or power sum polynomials, as the indeterminates. The Chern character is the e.g.f. of these traces and so its coefficients are given by the Faber polynomials with this entry's partition polynomials as the indeterminates. See the Mathoverflow question "A canonical reference for Chern characteristic classes". - Tom Copeland, Nov 04 2019
For an application to the physics of charged fermions in an external field, see Figueroa et al. - Tom Copeland, Dec 05 2019
Konopelchenko, in Proposition 5.2, p. 19, defines an operator P_k that is a differently signed operator version of the partition polynomials of this entry divided by a factorial. These operators give rise to bilinear Hirota equations for the KP hierarchy. These partition polynomials are also presented in Hopf algebras of symmetric functions by Cartier. - Tom Copeland, Dec 18 2019
For relationship of these partition polynomials to calculations of Pontryagin classes and the Riemann xi function, see A231846. - Tom Copeland, May 27 2020
Luest and Skliros summarize on p. 298 many of the properties of the cycle index polynomials given here; and Bianchi and Firrotta, a few on p. 6. - Tom Copeland, Oct 15 2020
From Tom Copeland, Oct 15 2020: (Start)
With a_n = n! * b_n = (n-1)! * c_n for n > 0, represent a function with f(0) = a_0 = b_0 = 1 as an
A) exponential generating function (e.g.f), or formal Taylor series: f(x) = e^{a.x} = 1 + Sum_{n > 0} a_n * x^n/n!
B) ordinary generating function (o.g.f.), or formal power series: f(x) = 1/(1-b.x) = 1 + Sum_{n > 0} b_n * x^n
C) logarithmic generating function (l.g.f): f(x) = 1 - log(1 - c.x) = 1 + Sum_{n > 0} c_n * x^n /n.
Expansions of log(f(x)) are given in
I) A127671 and A263634 for the e.g.f: log[ e^{a.*x} ] = e^{L.(a_1,a_2,...)x} = Sum_{n > 0} L_n(a_1,...,a_n) * x^n/n!, the logarithmic polynomials, cumulant expansion polynomials
II) A263916 for the o.g.f.: log[ 1/(1-b.x) ] = log[ 1 - F.(b_1,b_2,...)x ] = -Sum_{n > 0} F_n(b_1,...,b_n) * x^n/n, the Faber polynomials.
Expansions of exp(f(x)-1) are given in
III) A036040 for an e.g.f: exp[ e^{a.x} - 1 ] = e^{BELL.(a_1,...)x}, the Bell/Touchard/exponential partition polynomials, a.k.a. the Stirling partition polynomials of the second kind
IV) A130561 for an o.g.f.: exp[ b.x/(1-b.x) ] = e^{LAH.(b.,...)x}, the Lah partition polynomials
V) A036039 for an l.g.f.: exp[ -log(1-c.x) ] = e^{CIP.(c_1,...)x}, the cycle index polynomials of the symmetric groups S_n, a.k.a. the Stirling partition polynomials of the first kind.
Since exp and log are a compositional inverse pair, one can extract the indeterminates of the log set of partition polynomials from the exp set and vice versa. For a discussion of the relations among these polynomials and the combinatorics of connected and disconnected graphs/maps, see Novak and LaCroix on classical moments and cumulants and the two books on statistical mechanics referenced in A036040. (End)

Examples

			The partition array T(n, k) begins (see the W. Lang link for rows 1..10):
  n\k   1    2    3    4    5    6    7    8    9   10   11  12   13  14 15 ...
  1:    1
  2:    1    1
  3:    2    3    1
  4:    6    8    3    6    1
  5:   24   30   20   20   15   10    1
  6:  120  144   90   40   90  120   15   40   45   15    1
  7:  720  840  504  420  504  630  280  210  210  420  105  70  105  21  1
... reformatted by _Wolfdieter Lang_, May 25 2019
		

References

  • Abramowitz and Stegun, Handbook, p. 831, column labeled "M_2".

Crossrefs

Cf. other versions based on different partition orderings: A102189 (rows reversed), A181897, A319192.
Cf. A133932.
Cf. A231846.
Cf. A127671.

Programs

  • Maple
    nmax:=7: with(combinat): for n from 1 to nmax do P(n):=sort(partition(n)): for r from 1 to numbpart(n) do B(r):=P(n)[r] od: for m from 1 to numbpart(n) do s:=0: j:=0: while sA036039(n, m) := n!/ (mul((t)^q(t)*q(t)!, t=1..n)); od: od: seq(seq(A036039(n, m), m=1..numbpart(n)), n=1..nmax); # Johannes W. Meijer, Jul 14 2016
    # 2nd program:
    A036039 := proc(n,k)
        local a,prts,e,ai ;
        a := n! ;
        # ASPrts is implemented in A119441
        prts := ASPrts(n)[k] ;
        ai := 1;
        for e from 1 to nops(prts) do
            if e>1 then
                if op(e,prts) = op(e-1,prts) then
                    ai := ai+1 ;
                else
                    ai := 1;
                end if;
            end if;
            a := a/(op(e,prts)*ai) ;
        end do:
        a ;
    end proc:
    seq(seq(A036039(n,k),k=1..combinat[numbpart](n)),n=1..15) ; # R. J. Mathar, Dec 18 2016
  • Mathematica
    aspartitions[n_]:=Reverse/@Sort[Sort/@IntegerPartitions[n]];(* Abramowitz & Stegun ordering *);
    ascycleclasses[n_Integer]:=n!/(Times@@ #)&/@((#!
    Range[n]^#)&/@Function[par,Count[par,# ]&/@Range[n]]/@aspartitions[n])
    (* The function "ascycleclasses" is then identical with A&S multinomial M2. *)
    Table[ascycleclasses[n], {n, 1, 8}] // Flatten
    (* Wouter Meeussen, Jun 26 2009, Jun 27 2009 *)
  • Sage
    def PartAS(n):
        P = []
        for k in (1..n):
            Q = [p.to_list() for p in Partitions(n, length=k)]
            for q in Q: q.reverse()
            P = P + sorted(Q)
        return P
    def A036039_row(n):
        fn, C = factorial(n), []
        for q in PartAS(n):
            q.reverse()
            p = Partition(q)
            fp = 1; pf = 1
            for a, c in p.to_exp_dict().items():
                fp *= factorial(c)
                pf *= factorial(a)**c
            co = fn//(fp*pf)
            C.append(co*prod([factorial(i-1) for i in p]))
        return C
    for n in (1..10):
        print(A036039_row(n)) # Peter Luschny, Dec 18 2016

Formula

T(n,k) = n!/Product_{j=1..n} j^a(n,k,j)*a(n,k,j)!, with the k-th partition of n >= 1 in Abromowitz-Stegun order written as Product_{j=1..n} j^a(n,k,j) with nonnegative integers a(n,k,j) satisfying Sum_{j=1..n} j*a(n,k,j) = n, and the number of parts is Sum_{j=1..n} a(n,k,j) =: m(n,k). - Wolfdieter Lang, May 25 2019
Raising and lowering operators are given for the partition polynomials formed from this sequence in the link in "Lagrange a la Lah Part I" on p. 23. - Tom Copeland, Sep 18 2011
From Szabo p. 34, with b_n = q^n / (1-q^n)^2, the partition polynomials give an expansion of the MacMahon function M(q) = Product_{n>=1} 1/(1-q^n)^n = Sum_{n>=0} PL(n) q^n, the generating function for PL(n) = n! P_n(b_1,...,b_n), the number of plane partitions with sum n. - Tom Copeland, Nov 11 2015
From Tom Copeland, Nov 18 2015: (Start)
The partition polynomials of A036040 are obtained by substituting x[n]/(n-1)! for x[n] in the partition polynomials of this entry.
CIP_n(t-F(1,b1),-F(2,b1,b2),...,-F(n,b1,...,bn)) = P_n(b1,...,bn;t), where CIP_n are the partition polynomials of this entry; F(n,...), those of A263916; and P_n, those defined in my formula in A094587, e.g., P_2(b1,b2;t) = 2 b2 + 2 b1 t + t^2.
CIP_n(-F(1,b1),-F(2,b1,b2),...,-F(n,b1,...,bn)) = n! bn. (End)
From the relation to the elementary Schur polynomials given in A130561 and above, the partition polynomials of this array satisfy (d/d(x_m)) P(n,x_1,...,x_n) = (1/m) * (n!/(n-m)!) * P(n-m,x_1,...,x_(n-m)) with P(k,...) = 0 for k<0. - Tom Copeland, Sep 07 2016
Regarded as Appell polynomials in the indeterminate x(1)=u, the partition polynomials of this entry P_n(u) obey d/du P_n(u) = n * P_{n-1}(u), so the abscissas for the zeros of P_n(u) are the same as those of the extrema of P{n+1}(u). In addition, the coefficient of u^{n-1} in P_{n}(u) is zero since these polynomials are related to the characteristic polynomials of matrices with null main diagonals, and, therefore, the trace is zero, further implying the abscissa for any zero is the negative of the sum of the abscissas of the remaining zeros. This assumes all zeros are distinct and real. - Tom Copeland, Nov 10 2019

Extensions

More terms from David W. Wilson
Title expanded by Tom Copeland, Oct 15 2020

A238349 Triangle T(n,k) read by rows: T(n,k) is the number of compositions of n with k parts p at position p (fixed points), n>=0, 0<=k<=n.

Original entry on oeis.org

1, 0, 1, 1, 1, 0, 2, 1, 1, 0, 3, 4, 1, 0, 0, 6, 7, 3, 0, 0, 0, 11, 16, 4, 1, 0, 0, 0, 22, 29, 12, 1, 0, 0, 0, 0, 42, 60, 23, 3, 0, 0, 0, 0, 0, 82, 120, 47, 7, 0, 0, 0, 0, 0, 0, 161, 238, 100, 12, 1, 0, 0, 0, 0, 0, 0, 316, 479, 198, 30, 1, 0, 0, 0, 0, 0, 0, 0, 624, 956, 404, 61, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1235, 1910, 818, 126, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

Joerg Arndt and Alois P. Heinz, Feb 25 2014

Keywords

Comments

T(n*(n+3)/2,n) = A227682(n).
From Vaclav Kotesovec, Sep 07 2014: (Start)
In general, column k is asymptotic to c(k) * 2^n. The constants c(k) numerically:
c(0) = 0.144394047543301210639449860964615390044455952420342... = A048651/2
c(1) = 0.231997216225445223894202367545783700531838988546098... = c(0)*A065442
c(2) = 0.104261929557371534733906196116707679501974368826074...
c(3) = 0.017956317806894073430249112172514186063327165575720...
c(4) = 0.001343254222922697613125145839110293324517874530073...
c(5) = 0.000046459767012163920051487037952792359225887287888...
c(6) = 0.000000768651747857094917953943327540619110335556499...
c(7) = 0.000000006200599904985793344094393321042983316604040...
c(8) = 0.000000000024656652167851516076173236693314090168122...
c(9) = 0.000000000000048633746319332356416193899916110113745...
c(10)= 0.000000000000000047750743608910618576944191079881479...
c(20)= 1.05217230403079700467566...*10^(-63)
For big k is c(k) ~ m * 2^(-k*(k+1)/2), where m = 1/(4*c(0)) = 1/(2*A048651) = 1.7313733097275318...
(End)

Examples

			Triangle starts:
00:  1,
01:  0, 1,
02:  1, 1, 0,
03:  2, 1, 1, 0,
04:  3, 4, 1, 0, 0,
05:  6, 7, 3, 0, 0, 0,
06:  11, 16, 4, 1, 0, 0, 0,
07:  22, 29, 12, 1, 0, 0, 0, 0,
08:  42, 60, 23, 3, 0, 0, 0, 0, 0,
09:  82, 120, 47, 7, 0, 0, 0, 0, 0, 0,
10:  161, 238, 100, 12, 1, 0, 0, 0, 0, 0, 0,
11:  316, 479, 198, 30, 1, 0, 0, 0, 0, 0, 0, 0,
12:  624, 956, 404, 61, 3, 0, 0, 0, 0, 0, 0, 0, 0,
13:  1235, 1910, 818, 126, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0,
14:  2449, 3817, 1652, 258, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
15:  4864, 7633, 3319, 537, 30, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
...
From _Gus Wiseman_, Apr 03 2022: (Start)
Row n = 5 counts the following compositions (empty columns indicated by dots):
  (5)     (14)     (113)   .  .  .
  (23)    (32)     (122)
  (41)    (131)    (1211)
  (212)   (221)
  (311)   (1112)
  (2111)  (1121)
          (11111)
(End)
		

References

  • M. Archibald, A. Blecher and A. Knopfmacher, Fixed points in compositions and words, accepted by the Journal of Integer Sequences.

Crossrefs

Row sums are A011782.
The version for permutations is A008290.
The version with all zeros removed is A238350.
The version for reversed partitions is A238352.
The corresponding rank statistic is A352512, nonfixed A352513.
The version for nonfixed points is A352523, A352520 (k=1).
Below: comps = compositions, first = column k=0, stat = rank statistic.
- A352521 counts comps by strong nonexcedances, first A219282, stat A352514.
- A352522 counts comps by weak nonexcedances, first A238874, stat A352515.
- A352524 counts comps by strong excedances, first A008930, stat A352516.
- A352525 counts comps by weak excedances, A177510 (k=1), stat A352517.

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0, 1, expand(
           add(b(n-j, i+1)*`if`(i=j, x, 1), j=1..n)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..n))(b(n, 1)):
    seq(T(n), n=0..15);
  • Mathematica
    b[n_, i_] := b[n, i] = If[n == 0, 1, Expand[Sum[b[n-j, i+1]*If[i == j, x, 1], {j, 1, n}]]]; T[n_] := Function[{p}, Table[Coefficient[p, x, i], {i, 0, n}]][b[n, 1]]; Table[T[n], {n, 0, 15}] // Flatten (* Jean-François Alcover, Jan 06 2015, after Alois P. Heinz *)
    pq[y_]:=Length[Select[Range[Length[y]],#==y[[#]]&]];
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],pq[#]==k&]],{n,0,9},{k,0,n}] (* Gus Wiseman, Apr 03 2022 *)

A098825 Triangle read by rows: T(n,k) = number of partial derangements, that is, the number of permutations of n distinct, ordered items in which exactly k of the items are in their natural ordered positions, for n >= 0, k = n, n-1, ..., 1, 0.

Original entry on oeis.org

1, 1, 0, 1, 0, 1, 1, 0, 3, 2, 1, 0, 6, 8, 9, 1, 0, 10, 20, 45, 44, 1, 0, 15, 40, 135, 264, 265, 1, 0, 21, 70, 315, 924, 1855, 1854, 1, 0, 28, 112, 630, 2464, 7420, 14832, 14833, 1, 0, 36, 168, 1134, 5544, 22260, 66744, 133497, 133496, 1, 0, 45, 240, 1890, 11088, 55650, 222480, 667485, 1334960, 1334961
Offset: 0

Views

Author

Gerald P. Del Fiacco, Nov 02 2004

Keywords

Comments

In other words, T(n,k) is the number of permutations of n letters that are at Hammimg distance k from the identity permutation (cf. Diaconis, p. 112). - N. J. A. Sloane, Mar 02 2007
The sequence d(n) = 1, 0, 1, 2, 9, 44, 265, 1854, 14833, ... (A000166) is the number of derangements, that is, the number of permutations of n distinct, ordered items in which none of the items is in its natural ordered position.

Examples

			Assume d(0), d(1), d(2) are given. Then
  T(3, 3) = c(3, 3)*d(0) = (1)*(1) = 1;
  T(3, 2) = c(3, 2)*d(1) = (3)*(0) = 0;
  T(3, 1) = c(3, 1)*d(2) = (3)*(1) = 3;
  T(3, 0) = 3! - (1 + 0 + 3) = 6 - 4 = 2.
  d(3) = T(3, 0).
Triangle begins:
  1;
  1, 0;
  1, 0,  1;
  1, 0,  3,  2;
  1, 0,  6,  8,   9;
  1, 0, 10, 20,  45,  44;
  1, 0, 15, 40, 135, 264,  265;
  1, 0, 21, 70, 315, 924, 1855, 1854;
  ...
		

Crossrefs

Mirror of triangle A008290.
T(2n,n) gives A281262.

Programs

  • Haskell
    a098825 n k = a098825_tabl !! n !! k
    a098825_row n = a098825_tabl !! n
    a098825_tabl = map (zipWith (*) a000166_list) a007318_tabl
    -- Reinhard Zumkeller, Dec 16 2013
    
  • Mathematica
    t[0, 0] = 1; t[n_, k_] := Binomial[n, k]*k!*Sum[(-1)^j/j!, {j, 0, k}]; Flatten[ Table[ t[n, k], {n, 0, 10}, {k, 0, n}]] (* Robert G. Wilson v, Nov 04 2004 *)
    T[n_, k_] := Binomial[n, n-k] Subfactorial[k];
    Table[T[n, k], {n, 0, 10}, {k, 0, n}] // Flatten (* Jean-François Alcover, Sep 01 2021 *)
    (* Sum-free code *)
    T[n_, k_] = If[k==0,1,Binomial[n,k] Round[k!/E]];
    Table[T[n, k],{n,0,12},{k,0,n}]//Flatten (* Manfred Boergens, Oct 25 2022 *)
  • Python
    from functools import cache
    @cache
    def T(n, k):  # (after Oliver Seipel)
        if k == 0: return 1
        if k == n: return (-1)**n + n * T(n-1, k-1)
        return (T(n-1, k) * n) // (n - k)
    print([T(n, k) for n in range(11) for k in range(n+1)]) # Peter Luschny, Nov 30 2024

Formula

T(0, 0) = 1; d(0) = T(0, 0); for k = n, n-1, ..., 1, T(n, k) = c(n, k) d(n-k) where c(n, k) = n! / [(k!) (n-k)! ]; T(n, 0) = n! - [ T(n, n) + T(n, n-1) + ... + T(n, 1) ]; d(n) = T(n, 0).
T(n,k) = A008290(n,n-k). - Vladeta Jovovic, Sep 04 2006
Assuming a uniform distribution on S_n, the mean Hamming distance is n-1 and the variance is 1 (Diaconis, p. 117). - N. J. A. Sloane, Mar 02 2007
From Manfred Boergens, Oct 25 2022: (Start)
T(n, k) = (n!/(n-k)!)*Sum_{j=0..k} (-1)^j/j!.
T(n,0)=1; T(n, k) = C(n, k)*round(k!/e) = C(n,k)*A000166(k) = C(n, k)*floor(k!/e + 1/2) for k > 0. (End)
T(n, k) = (T(n-1, k)*n)/(n - k) for 0 < k < n, T(n, 0) = 1, and T(n, n) = (-1)^n + n*T(n-1, k-1). - Oliver Seipel, Nov 26 2024

Extensions

More terms from Robert G. Wilson v, Nov 04 2004

A000240 Rencontres numbers: number of permutations of [n] with exactly one fixed point.

Original entry on oeis.org

1, 0, 3, 8, 45, 264, 1855, 14832, 133497, 1334960, 14684571, 176214840, 2290792933, 32071101048, 481066515735, 7697064251744, 130850092279665, 2355301661033952, 44750731559645107, 895014631192902120, 18795307255050944541, 413496759611120779880
Offset: 1

Views

Author

Keywords

Comments

a(n) is also the number of permutations of [n] having no circular succession. A circular succession in a permutation p of [n] is either a pair p(i), p(i+1), where p(i+1)=p(i)+1 or the pair p(n), p(1) if p(1)=p(n)+1. a(4)=8 because we have 1324, 1432, 4132, 2143, 2413, 3214, 3241, and 4321. - Emeric Deutsch, Sep 06 2010
a(n) is also the number of permutations of [n] having no substring in {12, 23, ..., (n-1)n, n1}. For example, a(4) = 8 since we have 1324, 1432, 4213, 2143, 2431, 3214, 3142, 4321 (different from permutations having no circular succession). - Enrique Navarrete, Oct 07 2016
a(n-1) is also the number of permutations of [n] that allow the substring n1 in the set of permutations of [n] having no substring in {12, 23, ..., (n-1)n}. For example, for n=5 the 8 permutations in S5 having no substring in {12,23,34,45} that allow the substring 51 are {51324,51432,25143,24351,35142,32514,42513,43251} (see link). - Enrique Navarrete, Jan 11 2017
From Enrique Navarrete, Mar 25 2017: (Start)
Let D(n,k) be the set of permutations on [n] that for fixed k, 0 < k < n, avoid substrings j(j+k) for 1 <= j <= n - k, and avoid substrings j(j+k) (mod n) for n-k < j <= n. Then the number of permutations in D(n,k) with k relative prime to n, n>=2, is given by a(n). For example, the forbidden substrings in D(4,3) are {14;21,32,43} (the forbidden substrings (mod 4) are written after the semicolon and lie below the diagonal in the chessboard below):
1 2 3 4
1 |||_|x|
2 |x|||_|
3 ||x||_|
4 |||x|_|
_
Then since 4 and 3 are relatively prime, a(4)=8, and the permutations in D(4,3) are 1234, 1342, 2341, 2413, 3124, 3412, 4123, 4231.
For another example, the forbidden substrings in D(8,5) are {16,27,38;41, 52,63,74,85} and the number of permutations in D(8,5) is a(8)=14832 (see the "K-Shift Forbidden Substrings" link).
(End)

Examples

			a(3) = 3 because the permutations of {1,2,3} with exactly one fixed point are the transpositions (1 2), (1 3) and (2 3).
a(4) = 8 because for each element x of {1,2,3,4} there are exactly two permutations which leave only x invariant, namely the two circular permutations of the three remaining numbers, one being the inverse (and the square) of the other. - _M. F. Hasler_, Jan 16 2017
		

References

  • Kaufmann, Arnold. "Introduction à la combinatorique en vue des applications." Dunod, Paris, 1968. See p. 92.
  • J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p. 65.
  • 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).
  • N. Ya. Vilenkin, Combinatorics, p. 56, eq.(13), F_n = a(n). Academic Press, 1971.

Crossrefs

A diagonal of A008291.

Programs

  • Maple
    G(x):=exp(-x)/(1-x)*x: f[0]:=G(x): for n from 1 to 26 do f[n]:=diff(f[n-1],x) od: x:=0: seq(f[n],n=1..22);# Zerinvary Lajos, Apr 03 2009
    A000240 := proc(n)
            n!*add((-1)^k/k!,k=0..n-1) ;
    end proc: # R. J. Mathar, Jul 09 2012
    a := n -> (-1)^(n-1)*n*hypergeom([1,1-n], [], 1):
    seq(simplify(a(n)), n=1..22); # Peter Luschny, May 09 2017
  • Mathematica
    Table[Subfactorial[n]-(-1)^n, {n, 1, 25}] (* Zerinvary Lajos, Jul 10 2009, updated for offset 1 by Jean-François Alcover, Jan 10 2014 *)
    Table[n!*Sum[(-1)^k/k!,{k,0,n-1}],{n,1,25}] (* Vaclav Kotesovec, Sep 26 2012 *)
    Table[n!*SeriesCoefficient[x*E^(-x)/(1-x),{x,0,n}],{n,1,25}] (* Vaclav Kotesovec, Sep 26 2012 *)
    Rest[With[{nn=30},CoefficientList[Series[x Exp[-x]/(1-x),{x,0,nn}],x] Range[0,nn]!]] (* Harvey P. Dale, May 29 2025 *)
  • PARI
    x='x+O('x^66); Vec( serlaplace(x*exp(-x)/(1-x)) ) \\ Joerg Arndt, Feb 19 2014
    
  • PARI
    a(n,p=vector(n,i,i),s=x->!x)=sum(k=1,n!,#select(s,numtoperm(n,k)-p)==1) \\ For illustrative purpose. #select(...) is almost twice as fast as {p=numtoperm(n,k);sum(i=1,n,p[i]==i)}. - M. F. Hasler, Jan 16 2017
  • Python
    a = 0
    for i in range(1, 51):
        a = (a - (-1)**i)*i
        print(a, end=',') # Alex Ratushnyak, Apr 20 2012
    

Formula

E.g.f.: x*exp(-x)/(1-x). [Corrected by Vaclav Kotesovec, Sep 26 2012]
a(n) = Sum_{k=0..n-1} (-1)^k*n!/k!.
a(n) = A180188(n,0). - Emeric Deutsch, Sep 06 2010
E.g.f.: x*A(x) where A(x) is the e.g.f. for A000166. - Geoffrey Critzer, Jan 14 2012
a(n) = n*a(n-1) - (-1)^n*n = A000166(n) - (-1)^n = n*A000166(n-1) = A000387(n+1)*2/(n+1) = A000449(n+2)*6/((n+1)*(n+2)).
a(n) = n*floor(((n-1)!+1)/e), n > 1. - Gary Detlefs, Jul 13 2010
Limit_{n->infinity} n!/a(n) = e = 2.71828...
a(n) = (n-1)*(a(n-1)+a(n-2)) + (-1)^(n-1), n>=2. - Enrique Navarrete, Oct 07 2016
O.g.f.: Sum_{k>=1} k!*x^k/(1 + x)^(k+1). - Ilya Gutkovskiy, Apr 13 2017
a(n) = (-1)^(n-1)*n*hypergeom([1,1-n], [], 1). - Peter Luschny, May 09 2017

A000023 Expansion of e.g.f. exp(-2*x)/(1-x).

Original entry on oeis.org

1, -1, 2, -2, 8, 8, 112, 656, 5504, 49024, 491264, 5401856, 64826368, 842734592, 11798300672, 176974477312, 2831591702528, 48137058811904, 866467058876416, 16462874118127616, 329257482363600896, 6914407129633521664, 152116956851941670912
Offset: 0

Views

Author

Keywords

Comments

A010843, A000023, A000166, A000142, A000522, A010842, A053486, A053487 are successive binomial transforms with the e.g.f. exp(k*x)/(1-x) and recurrence b(n) = n*b(n-1)+k^n and are related to incomplete gamma functions at k. In this case k=-2, a(n) = n*a(n-1)+(-2)^n = Gamma(n+1,k)*exp(k) = Sum_{i=0..n} (-1)^(n-i)*binomial(n,i)*i^(n-i)*(i+k)^i. - Vladeta Jovovic, Aug 19 2002
a(n) is the permanent of the n X n matrix with -1's on the diagonal and 1's elsewhere. - Philippe Deléham, Dec 15 2003

Examples

			G.f. = 1 - x + 2*x^2 - 2*x^3 + 8*x^4 + 8*x^5 + 112*x^6 + 656*x^7 + ... - _Michael Somos_, Nov 20 2018
		

References

  • J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p. 210.
  • 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

  • Haskell
    a000023 n = foldl g 1 [1..n]
      where g n m = n*m + (-2)^m
    -- James Spahlinger, Oct 08 2012
    
  • Maple
    a := n -> n!*add(((-2)^k/k!), k=0..n): seq(a(n), n=0..27); # Zerinvary Lajos, Jun 22 2007
    seq(simplify(KummerU(-n, -n, -2)), n = 0..22); # Peter Luschny, May 10 2022
  • Mathematica
    FoldList[#1*#2 + (-2)^#2 &, 1, Range[22]] (* Robert G. Wilson v, Jul 07 2012 *)
    With[{r = Round[n!/E^2 - (-2)^(n + 1)/(n + 1)]}, r - (-1)^n Mod[(-1)^n r, 2^(n + Ceiling[-(2/n) - Log[2, n]])]] (* Stan Wagon May 02 2016 *)
    a[n_] := (-1)^n x D[1/x Exp[x], {x, n}] x^n Exp[-x]
    Table[a[n] /. x -> 2, {n, 0, 22}](* Gerry Martens , May 05 2016 *)
  • PARI
    a(n)=if(n<0,0,n!*polcoeff(exp(-2*x+x*O(x^n))/(1-x),n))
    
  • PARI
    my(x='x+O('x^66)); Vec( serlaplace( exp(-2*x)/(1-x)) ) \\ Joerg Arndt, Oct 06 2013
    
  • Python
    from sympy import exp, uppergamma
    def A000023(n):
        return exp(-2) * uppergamma(n + 1, -2)  # David Radcliffe, Aug 20 2025
  • Sage
    @CachedFunction
    def A000023(n):
        if n == 0: return 1
        return n * A000023(n-1) + (-2)**n
    [A000023(i) for i in range(23)]   # Peter Luschny, Oct 17 2012
    

Formula

a(n) = Sum_{k=0..n} A008290(n,k)*(-1)^k. - Philippe Deléham, Dec 15 2003
a(n) = Sum_{k=0..n} (-2)^(n-k)*n!/(n-k)! = Sum_{k=0..n} binomial(n, k)*k!*(-2)^(n-k). - Paul Barry, Aug 26 2004
a(n) = exp(-2)*Gamma(n+1,-2) (incomplete Gamma function). - Mark van Hoeij, Nov 11 2009
a(n) = b such that (-1)^n*Integral_{x=0..2} x^n*exp(x) dx = c + b*exp(2). - Francesco Daddi, Aug 01 2011
G.f.: hypergeom([1,k],[],x/(1+2*x))/(1+2*x) with k=1,2,3 is the generating function for A000023, A087981, and A052124. - Mark van Hoeij, Nov 08 2011
D-finite with recurrence: - a(n) + (n-2)*a(n-1) + 2*(n-1)*a(n-2) = 0. - R. J. Mathar, Nov 14 2011
E.g.f.: 1/E(0) where E(k) = 1 - x/(1-2/(2-(k+1)/E(k+1))); (continued fraction). - Sergei N. Gladkovskii, Nov 21 2011
G.f.: 1/Q(0), where Q(k) = 1 + 2*x - x*(k+1)/(1 - x*(k+1)/Q(k+1)); (continued fraction). - Sergei N. Gladkovskii, Apr 19 2013
G.f.: 1/Q(0), where Q(k) = 1 - x*(2*k-1) - x^2*(k+1)^2/Q(k+1); (continued fraction). - Sergei N. Gladkovskii, Sep 30 2013
a(n) = Sum_{k=0..n} (-1)^(n+k)*binomial(n, k)*!k, where !k is the subfactorial A000166. a(n) = (-2)^n*hypergeom([1, -n], [], 1/2). - Vladimir Reshetnikov, Oct 18 2015
For n >= 3, a(n) = r - (-1)^n mod((-1)^n r, 2^(n - floor((2/n) + log_2(n)))) where r = {n! * e^(-2) - (-2)^(n+1)/(n+1)}. - Stan Wagon, May 02 2016
0 = +a(n)*(+4*a(n+1) -2*a(n+3)) + a(n+1)*(+4*a(n+1) +3*a(n+2) -a(n+3)) +a(n+2)*(+a(n+2)) if n>=0. - Michael Somos, Nov 20 2018
a(n) = KummerU(-n, -n, -2). - Peter Luschny, May 10 2022

A000354 Expansion of e.g.f. exp(-x)/(1-2*x).

Original entry on oeis.org

1, 1, 5, 29, 233, 2329, 27949, 391285, 6260561, 112690097, 2253801941, 49583642701, 1190007424825, 30940193045449, 866325405272573, 25989762158177189, 831672389061670049, 28276861228096781665, 1017967004211484139941, 38682746160036397317757
Offset: 0

Views

Author

Keywords

Comments

a(n) is the permanent of the n X n matrix with 1's on the diagonal and 2's elsewhere. - Yuval Dekel, Nov 01 2003. Compare A157142.
Starting with offset 1 = lim_{k->infinity} M^k, where M = a tridiagonal matrix with (1,0,0,0,...) in the main diagonal, (1,3,5,7,...) in the subdiagonal and (2,4,6,8,...) in the subsubdiagonal. - Gary W. Adamson, Jan 13 2009
a(n) is also the number of (n-1)-dimensional facet derangements for the n-dimensional hypercube. - Elizabeth McMahon, Gary Gordon (mcmahone(AT)lafayette.edu), Jun 29 2009
a(n) is the number of ways to write down each n-permutation and underline some (possibly none or all) of the elements that are not fixed points. a(n) = Sum_{k=0..n} A008290(n,k)*2^(n-k). - Geoffrey Critzer, Dec 15 2012
Type B derangement numbers: the number of fixed point free permutations in the n-th hyperoctahedral group of signed permutations of {1,2,...,n}. See Chow 2006. See A000166 for type A derangement numbers. - Peter Bala, Jan 30 2015

Examples

			G.f. = 1 + x + 5*x^2 + 29*x^3 + 233*x^4 + 2329*x^5 + 27949*x^6 + 391285*x^7 + ... - _Michael Somos_, Apr 14 2018
		

References

  • J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p. 83.
  • 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

Column k=2 of A320032.

Programs

  • Maple
    a := n -> (-1)^n*(1-2*n*hypergeom([1,1-n],[],2)):
    seq(simplify(a(n)), n=0..18); # Peter Luschny, May 09 2017
    a := n -> 2^n*add((n!/k!)*(-1/2)^k, k=0..n):
    seq(a(n), n=0..23); # Peter Luschny, Jan 06 2020
    seq(simplify(2^n*KummerU(-n, -n, -1/2)), n = 0..19); # Peter Luschny, May 10 2022
  • Mathematica
    FunctionExpand @ Table[ Gamma[ n+1, -1/2 ]*2^n/Exp[ 1/2 ], {n, 0, 24}]
    With[{nn=20},CoefficientList[Series[Exp[-x]/(1-2x),{x,0,nn}],x] Range[0,nn]!] (* Harvey P. Dale, Jul 22 2013 *)
    a[n_] := 2^n n! Sum[(-1)^i/(2^i i!), {i, 0, n}]; Table[a[n], {n, 0, 20}] (* Gerry Martens, May 06 2016 *)
    a[ n_] := If[ n < 1, Boole[n == 0], (2 n - 1) a[n - 1] + (2 n - 2) a[n - 2]]; (* Michael Somos, Sep 28 2017 *)
    a[ n_] := Sum[ (-1)^(n + k) Binomial[n, k] k! 2^k, {k, 0, n}]; (* Michael Somos, Apr 14 2018 *)
    a[ n_] := If[ n < 0, 0, (2^n Gamma[n + 1, -1/2]) / Sqrt[E] // FunctionExpand]; (* Michael Somos, Apr 14 2018 *)
    a[n_] := n! 2^n Hypergeometric1F1[-n, -n, -1/2];
    Table[a[n], {n, 0, 19}]   (* Peter Luschny, Jul 28 2024 *)
  • PARI
    my(x='x+O('x^66)); Vec(serlaplace(exp(-x)/(1-2*x))) \\ Joerg Arndt, Apr 15 2013
    
  • PARI
    vector(100, n, n--; sum(k=0, n, (-1)^(n+k)*binomial(n, k)*k!*2^k)) \\ Altug Alkan, Oct 30 2015
    
  • PARI
    {a(n) = if( n<1, n==0, (2*n - 1) * a(n-1) + (2*n - 2) * a(n-2))}; /* Michael Somos, Sep 28 2017 */

Formula

Inverse binomial transform of double factorials A000165. - Paul Barry, May 26 2003
a(n) = Sum_{k=0..n} (-1)^(n+k)*C(n, k)*k!*2^k. - Paul Barry, May 26 2003
a(n) = Sum_{k=0..n} A008290(n, k)*2^(n-k). - Philippe Deléham, Dec 13 2003
a(n) = 2*n*a(n-1) + (-1)^n, n > 0, a(0)=1. - Paul Barry, Aug 26 2004
D-finite with recurrence a(n) = (2*n-1)*a(n-1) + (2*n-2)*a(n-2). - Elizabeth McMahon, Gary Gordon (mcmahone(AT)lafayette.edu), Jun 29 2009
From Groux Roland, Jan 17 2011: (Start)
a(n) = (1/(2*sqrt(exp(1))))*Integral_{x>=-1} exp(-x/2)*x^n dx;
Sum_{k>=0} 1/(k!*2^(k+1)*(n+k+1)) = (-1)^n*(a(n)*sqrt(exp(1))-2^n*n!). (End)
a(n) = round(2^n*n!/exp(1/2)), x >= 0. - Simon Plouffe, Mar 1993
G.f.: 1/Q(0), where Q(k) = 1 - x*(4*k+1) - 4*x^2*(k+1)^2/Q(k+1); (continued fraction). - Sergei N. Gladkovskii, Sep 30 2013
From Peter Bala, Jan 30 2015: (Start)
a(n) = Integral_{x = 0..inf} (2*x - 1)^n*exp(-x) dx.
b(n) := 2^n*n! satisfies the recurrence b(n) = (2*n - 1)*b(n-1) + (2*n - 2)*b(n-2), the same recurrence as satisfied by a(n). This leads to the continued fraction representation a(n) = 2^n*n!*( 1/(1 + 1/(1 + 2/(3 + 4/(5 +...+ (2*n - 2)/(2*n - 1) ))))) for n >= 2, which in the limit gives the continued fraction representation sqrt(e) = 1 + 1/(1 + 2/(3 + 4/(5 + ... ))). (End)
For n > 0, a(n) = 1 + 4*Sum_{k=0..n-1} A263895(n). - Vladimir Reshetnikov, Oct 30 2015
a(n) = (-1)^n*(1-2*n*hypergeom([1,1-n],[],2)). - Peter Luschny, May 09 2017
a(n+1) >= A113012(n). - Michael Somos, Sep 28 2017
a(0) = 1; a(n) = Sum_{k=1..n} binomial(n,k) * (2*k - 1) * a(n-k). - Ilya Gutkovskiy, Jan 17 2020
a(n) = 2^n*KummerU(-n, -n, -1/2). - Peter Luschny, May 10 2022
a(n) = 2^n*n!*hypergeom([-n], [-n], -1/2). - Peter Luschny, Jul 28 2024

A278984 Array read by antidiagonals downwards: T(b,n) = number of words of length n over an alphabet of size b that are in standard order.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 4, 2, 1, 1, 8, 5, 2, 1, 1, 16, 14, 5, 2, 1, 1, 32, 41, 15, 5, 2, 1, 1, 64, 122, 51, 15, 5, 2, 1, 1, 128, 365, 187, 52, 15, 5, 2, 1, 1, 256, 1094, 715, 202, 52, 15, 5, 2, 1, 1, 512, 3281, 2795, 855, 203, 52, 15, 5, 2, 1, 1, 1024, 9842, 11051, 3845, 876, 203, 52, 15, 5, 2, 1
Offset: 1

Views

Author

Joerg Arndt and N. J. A. Sloane, Dec 05 2016

Keywords

Comments

We study words made of letters from an alphabet of size b, where b >= 1. We assume the letters are labeled {1,2,3,...,b}. There are b^n possible words of length n.
We say that a word is in "standard order" if it has the property that whenever a letter i appears, the letter i-1 has already appeared in the word. This implies that all words begin with the letter 1.
Let X be the random variable that assigns to each permutation of {1,2,...,b} (with uniform distribution) its number of fixed points (as in A008290). Then T(b,n) is the n-th moment about 0 of X, i.e., the expected value of X^n. - Geoffrey Critzer, Jun 23 2020

Examples

			The array begins:
1,.1,..1,...1,...1,...1,...1,....1..; b=1, A000012
1,.2,..4,...8,..16,..32,..64,..128..; b=2, A000079
1,.2,..5,..14,..41,.122,.365,.1094..; b=3, A007051 (A278985)
1,.2,..5,..15,..51,.187,.715,.2795..; b=4, A007581
1,.2,..5,..15,..52,.202,.855,.3845..; b=5, A056272
1,.2,..5,..15,..52,.203,.876,.4111..; b=6, A056273
...
The rows tend to A000110.
		

Crossrefs

Rows 1 through 16 of the array are: A000012, A000079, A007051 (or A124302), A007581 (or A124303), A056272, A056273, A099262, A099263, A164863, A164864, A203641-A203646.
The limit of the rows is A000110, the Bell numbers.
See A278985 for the words arising in row b=3.
Cf. A203647, A137855 (essentially same table).

Programs

  • Maple
    with(combinat);
    f1:=proc(L,b) local t1;i;
    t1:=add(stirling2(L,i),i=1..b);
    end:
    Q1:=b->[seq(f1(L,b), L=1..20)]; # the rows of the array are Q1(1), Q1(2), Q1(3), ...
  • Mathematica
    T[b_, n_] := Sum[StirlingS2[n, j], {j, 1, b}]; Table[T[b-n+1, n], {b, 1, 12}, {n, b, 1, -1}] // Flatten (* Jean-François Alcover, Feb 18 2017 *)

Formula

The number of words of length n over an alphabet of size b that are in standard order is Sum_{j = 1..b} Stirling2(n,j).
Showing 1-10 of 114 results. Next