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

A086764 Triangle T(n, k), read by row, related to Euler's difference table A068106 (divide column k of A068106 by k!).

Original entry on oeis.org

1, 0, 1, 1, 1, 1, 2, 3, 2, 1, 9, 11, 7, 3, 1, 44, 53, 32, 13, 4, 1, 265, 309, 181, 71, 21, 5, 1, 1854, 2119, 1214, 465, 134, 31, 6, 1, 14833, 16687, 9403, 3539, 1001, 227, 43, 7, 1, 133496, 148329, 82508, 30637, 8544, 1909, 356, 57, 8, 1
Offset: 0

Views

Author

Philippe Deléham, Aug 02 2003

Keywords

Comments

The k-th column sequence, k >= 0, without leading zeros, enumerates the ways to distribute n beads, n >= 1, labeled differently from 1 to n, over a set of (unordered) necklaces, excluding necklaces with exactly one bead, and k+1 indistinguishable, ordered, fixed cords, each allowed to have any number of beads. Beadless necklaces as well as beadless cords each contribute a factor 1, hence for n=0 one has 1. See A000255 for the description of a fixed cord with beads. 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 02 2010

Examples

			Formatted as a square array:
      1      3     7    13   21   31  43 57 ... A002061;
      2     11    32    71  134  227 356    ... A094792;
      9     53   181   465 1001 1909        ... A094793;
     44    309  1214  3539 8544             ... A094794;
    265   2119  9403 30637                  ... A023043;
   1854  16687 82508                        ... A023044;
  14833 148329                              ... A023045;
Formatted as a triangular array (mirror of A076731):
       1;
       0      1;
       1      1     1;
       2      3     2     1;
       9     11     7     3    1;
      44     53    32    13    4    1;
     265    309   181    71   21    5    1;
    1854   2119  1214   465  134   31    6   1;
   14833  16687  9403  3539 1001  227   43   7   1;
  133496 148329 82508 30637 8544 1909  356  57   8   1;
		

Crossrefs

Programs

  • Magma
    A086764:= func< n,k | (&+[(-1)^j*Binomial(n-k,j)*Factorial(n-j): j in [0..n]])/Factorial(k) >;
    [A086764(n,k): k in [0..n], n in [0..12]]; // G. C. Greubel, Oct 05 2023
    
  • Mathematica
    T[n_,k_]:=(1/k!)*Sum[(-1)^j*Binomial[n-k,j]*(n-j)!,{j,0,n}];Flatten[Table[T[n,k],{n,0,11},{k,0,n}]] (* Indranil Ghosh, Feb 20 2017 *)
    T[n_, k_] := (n!/k!) HypergeometricPFQ[{k-n},{-n},-1];
    Table[T[n,k], {n,0,9}, {k,0,n}] // Flatten (* Peter Luschny, Oct 05 2017 *)
  • SageMath
    def A086764(n,k): return sum((-1)^j*binomial(n-k,j)*factorial(n-j) for j in range(n+1))//factorial(k)
    flatten([[A086764(n,k) for k in range(n+1)] for n in range(13)]) # G. C. Greubel, Oct 05 2023

Formula

T(n, n) = 1; T(n+1, n) = n.
T(n+2, n) = A002061(n+1) = n^2 + n + 1; T(n+3, n) = n^3 + 3*n^2 + 5*n + 2.
T(n, k) = (k + 1)*T(n, k + 1) - T(n-1, k); T(n, n) = 1; T(n, k) = 0, if k > n.
T(n, k) = (n-1)*T(n-1, k) + (n-k-1)*T(n-2, k).
k!*T(n, k) = A068106(n, k). [corrected by Georg Fischer, Aug 13 2022]
Sum_{k>=0} T(n, k) = A003470(n+1).
T(n, k) = (1/k!) * Sum_{j>=0} (-1)^j*binomial(n-k, j)*(n-j)!. - Philippe Deléham, Jun 13 2005
From Peter Bala, Aug 14 2008: (Start)
The following remarks all relate to the array read as a square array: e.g.f for column k: exp(-y)/(1-y)^(k+1); e.g.f. for array: exp(-y)/(1-x-y) = (1 + x + x^2 + x^3 + ...) + (x + 2*x^2 + 3*x^3 + 4*x^4 + ...)*y + (1 + 3*x + 7*x^2 + 13*x^3 + ...)*y^2/2! + ... .
This table is closely connected to the constant e. The row, column and diagonal entries of this table occur in series formulas for e.
Row n for n >= 2: e = n!*(1/T(n,0) + (-1)^n*[1/(1!*T(n,0)*T(n,1)) + 1/(2!*T(n,1)*T(n,2)) + 1/(3!*T(n,2)*T(n,3)) + ...]). For example, row 3 gives e = 6*(1/2 - 1/(1!*2*11) - 1/(2!*11*32) - 1/(3!*32*71) - ...). See A095000.
Column 0: e = 2 + Sum_{n>=2} (-1)^n*n!/(T(n,0)*T(n+1,0)) = 2 + 2!/(1*2) - 3 !/(2*9) + 4!/(9*44) - ... .
Column k, k >= 1: e = (1 + 1/1! + 1/2! + ... + 1/k!) + 1/k!*Sum_{n >= 0} (-1)^n*n!/(T(n,k)*T(n+1,k)). For example, column 3 gives e = 8/3 + 1/6*(1/(1*3) - 1/(3*13) + 2/(13*71) - 6/(71*465) + ...).
Main diagonal: e = 1 + 2*(1/(1*1) - 1/(1*7) + 1/(7*71) - 1/(71*1001) + ...).
First subdiagonal: e = 8/3 + 5/(3*32) - 7/(32*465) + 9/(465*8544) - ... .
Second subdiagonal: e = 2*(1 + 2^2/(1*11) - 3^2/(11*181) + 4^2/(181*3539) - ...). See A143413.
Third subdiagonal: e = 3 - (2*3*5)/(2*53) + (3*4*7)/(53*1214) - (4*5*9)/(1214*30637) + ... .
For the corresponding results for the constants 1/e, sqrt(e) and 1/sqrt(e) see A143409, A143410 and A143411 respectively. For other arrays similarly related to constants see A008288 (for log(2)), A108625 (for zeta(2)) and A143007 (for zeta(3)). (End)
G.f. for column k is hypergeom([1,k+1],[],x/(x+1))/(x+1). - Mark van Hoeij, Nov 07 2011
T(n, k) = (n!/k!)*hypergeom([k-n], [-n], -1). - Peter Luschny, Oct 05 2017

Extensions

More terms from David Wasserman, Mar 28 2005
Additional comments from Zerinvary Lajos, Mar 30 2006
Edited by N. J. A. Sloane, Sep 24 2011

A277609 Fourth column of Euler's difference table in A068106. It is 6 times the sequence A000261.

Original entry on oeis.org

0, 0, 6, 18, 78, 426, 2790, 21234, 183822, 1781802, 19104774, 224406930, 2864826126, 39486808938, 584328412518, 9238767895026, 155416555683150, 2771424197143914, 52216883883837702, 1036463580947218962, 21616958644969620174, 472612476001411964970, 10808196686285486012646
Offset: 1

Views

Author

Enrique Navarrete, Oct 23 2016

Keywords

Comments

For n >= 4, this is the number of permutations that avoid substrings j(j+3), 1 <= j <= n-3.
For n>=4, the number of circular permutations (in cycle notation) on [n+1] that avoid substrings (j,j+4), 1<=j<=n-3. For example, for n=4, there are 18 circular permutations in S5 that avoid the substring {15}. Note that each of these circular permutations represent 5 permutations in one-line notation (see link 2017). - Enrique Navarrete, Feb 22 2017

Examples

			a(5) = 78 since there are 78 permutations in S5 that avoid the substrings {14,25}.
		

Crossrefs

Programs

  • Mathematica
    Table[Sum[(-1)^j*Binomial[n - 3, j] (n - j)!, {j, 0, n - 3}], {n, 23}] (* Michael De Vlieger, Oct 27 2016 *)
    Flatten[{0, 0, Table[n!*Hypergeometric1F1[3-n, -n, -1], {n, 3, 20}]}] (* Vaclav Kotesovec, Oct 28 2016 *)
  • PARI
    a(n) = sum(j=0, n-3, (-1)^j*binomial(n-3,j)*(n-j)!); \\ Michel Marcus, Oct 29 2016

Formula

For n>=4: a(n) = Sum_{j=0..n-3} (-1)^j*binomial(n-3,j)*(n-j)!.
a(n) ~ exp(-1) * n!. - Vaclav Kotesovec, Oct 28 2016

A277563 Fifth column of Euler's difference table in A068106.

Original entry on oeis.org

0, 0, 0, 24, 96, 504, 3216, 24024, 205056, 1965624, 20886576, 243511704, 3089233056, 42351635064, 623815221456, 9823096307544, 164655323578176, 2926840752827064, 54988308080981616, 1088680464831056664, 22653422225916839136, 494229434646381585144, 11280809162286897977616
Offset: 1

Views

Author

Enrique Navarrete, Dec 03 2016

Keywords

Comments

This is 24 times the sequence A001909.
For n >= 5, this is the number of permutations that avoid substrings j(j+4), 1 <= j <= n-4.
For n>=5, the number of circular permutations (in cycle notation) on [n+1] that avoid substrings (j,j+5), 1<=j<=n-4. For example, for n=5, there are 96 circular permutations in S6 that avoid the substring {16}. Note that each of these circular permutations represent 6 permutations in one-line notation (see link 2017). - Enrique Navarrete, Feb 22 2017

Examples

			a(6) = 504 since there are 504 permutations in S6 that avoid the substrings {15,26}.
		

Crossrefs

Programs

  • Mathematica
    Array[Sum[(-1)^j*Binomial[# - 4, j] (# - j)!, {j, 0, # - 4} ] &, 23] (* Michael De Vlieger, Dec 06 2016 *)

Formula

For n>=5: a(n) = Sum_{j=0..n-4} (-1)^j*binomial(n-4,j)*(n-j)!.
a(n) ~ n!/e.

A280425 Sixth column of Euler's difference table in A068106.

Original entry on oeis.org

0, 0, 0, 0, 120, 600, 3720, 27240, 229080, 2170680, 22852200, 264398280, 3332744760, 45440868120, 666166856520, 10446911529000, 174478419885720, 3091496076405240, 57915148833808680, 1143668772912038280, 23742102690747895800, 516882856872298424280, 11775038596933279562760
Offset: 1

Views

Author

Enrique Navarrete, Jan 02 2017

Keywords

Comments

For n >= 6, this is the number of permutations of [n] that avoid substrings j(j+5), 1 <= j <= n-5.

Examples

			a(9) = 229080 since there are 229080 permutations in S9 that avoid substrings {16,27,38,49}.
		

Crossrefs

Also 120 times A001910.
Cf. A068106.

Programs

  • Mathematica
    a[1]=a[2]=a[3]=a[4]=0; a[5]=120;a[6]=600;a[n_]:=Sum[(-1)^j*Binomial[n-5,j]*(n-j)!,{j,0,n-5}];Table[a[n],{n,1,23}] (* Indranil Ghosh, Feb 25 2017 *)

Formula

For n>=6: a(n) = Sum_{j=0..n-5} (-1)^j*binomial(n-5,j)*(n-j)!.
Note a(n)/n! ~ 1/e.

A280920 Seventh column of Euler's difference table in A068106.

Original entry on oeis.org

0, 0, 0, 0, 0, 720, 4320, 30960, 256320, 2399760, 25022880, 287250480, 3597143040, 48773612880, 711607724640, 11113078385520, 184925331414720, 3265974496290960, 61006644910213920, 1201583921745846960, 24885771463659934080, 540624959563046320080, 12291921453805577987040
Offset: 1

Views

Author

Enrique Navarrete, Jan 10 2017

Keywords

Comments

For n >= 7, this is the number of permutations of [n] that avoid substrings j(j+6), 1 <= j <= n-6.

Examples

			a(10)=2399760 since there are 2399760 permutations in S10 that avoid substrings {17,28,39,4(10)}.
		

Crossrefs

Also 720 times A176732.
Cf. A068106.

Programs

  • Mathematica
    Table[Sum[(-1)^j*Binomial[n-6,j]*(n-j)!,{j,0,n-6}],{n,1,23}] (* Indranil Ghosh, Feb 26 2017 *)
  • PARI
    a(n) = sum(j=0, n-6, (-1)^j*binomial(n-6,j)*(n-j)!); \\ Michel Marcus, Feb 26 2017
  • Python
    f=math.factorial
    def C(n,r):return f(n)/f(r)/f(n-r)
    def A280920(n):
        s=0
        for j in range(0,n-5):
            s+=(-1)**j*C(n-6,j)*f(n-j)
        return s # Indranil Ghosh, Feb 26 2017
    

Formula

For n>=7: a(n) = Sum_{j=0..n-6} (-1)^j*binomial(n-6,j)*(n-j)!.
Note a(n)/n! ~ 1/e.

A284204 Eighth column of Euler's difference table in A068106.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 5040, 35280, 287280, 2656080, 27422640, 312273360, 3884393520, 52370755920, 760381337520, 11824686110160, 196038409800240, 3450899827705680, 64272619406504880, 1262590566656060880, 26087355385405781040, 565510731026706254160
Offset: 1

Views

Author

Enrique Navarrete, Mar 22 2017

Keywords

Comments

For n >= 8, this is the number of permutations of [n] that avoid substrings j(j+7), 1 <= j <= n-7.

Examples

			a(11)=27422640 since this is the number of permutations in S11 that avoid substrings {18,29,3(10),4(11)}.
		

Crossrefs

Also 5040 times A176733.
Cf. A068106.

Programs

  • Mathematica
    With[{k = 8}, ConstantArray[0, k - 2]~Join~Table[Sum[(-1)^j*Binomial[n - (k - 1), j] (n - j)!, {j, 0, n - (k - 1)}], {n, k - 1, k + 12}]] (* Michael De Vlieger, Mar 26 2017 *)

Formula

For n>=8: a(n) = Sum_{j=0..n-7} (-1)^j*binomial(n-7,j)*(n-j)!.
Note a(n)/n! ~ 1/e.

A284205 Ninth column of Euler's difference table in A068106.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 40320, 322560, 2943360, 30078720, 339696000, 4196666880, 56255149440, 812752093440, 12585067447680, 207863095910400, 3646938237505920, 67723519234210560, 1326863186062565760, 27349945952061841920, 591598086412112035200
Offset: 1

Views

Author

Enrique Navarrete, Mar 22 2017

Keywords

Comments

For n >= 9, this is the number of permutations of [n] that avoid substrings j(j+8), 1 <= j <= n-8.

Examples

			a(12)=339696000 since this is the number of permutations in S12 that avoid substrings {19,2(10),3(11),4(12)}.
		

Crossrefs

Also 40320 times A176734.
Cf. A068106.

Programs

  • Mathematica
    With[{k = 9}, ConstantArray[0, k - 2]~Join~Table[Sum[(-1)^j*Binomial[n - (k - 1), j] (n - j)!, {j, 0, n - (k - 1)}], {n, k - 1, k + 12}]] (* Michael De Vlieger, Mar 26 2017 *)

Formula

For n>=9: a(n) = Sum_{j=0..n-8} (-1)^j*binomial(n-8,j)*(n-j)!.
Note a(n)/n! ~ 1/e.

A284206 Tenth column of Euler's difference table in A068106.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 362880, 3265920, 33022080, 369774720, 4536362880, 60451816320, 869007242880, 13397819541120, 220448163358080, 3854801333416320, 71370457471716480, 1394586705296776320, 28676809138124407680, 618948032364173877120
Offset: 1

Views

Author

Enrique Navarrete, Mar 22 2017

Keywords

Comments

For n >= 10, this is the number of permutations of [n] that avoid substrings j(j+9), 1 <= j <= n-9.

Examples

			a(13)=4536362880 since this is the number of permutations in S13 that avoid substrings {1(10),2(11),3(12),4(13)}.
		

Crossrefs

Also 362880 times A176735.
Cf. A068106.

Programs

  • Mathematica
    Table[Sum[(-1)^j*Binomial[n - 9, j]*(n - j)!, {j, 0, n - 9}], {n, 22}] (* Michael De Vlieger, Apr 03 2017 *)

Formula

For n>=10: a(n) = Sum_{j=0..n-9} (-1)^j*binomial(n-9,j)*(n-j)!.
Note a(n)/n! ~ 1/e.

A284207 Eleventh column of Euler's difference table in A068106.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 3628800, 36288000, 402796800, 4906137600, 64988179200, 929459059200, 14266826784000, 233845982899200, 4075249496774400, 75225258805132800, 1465957162768492800, 30071395843421184000, 647624841502298284800
Offset: 1

Views

Author

Enrique Navarrete, Mar 22 2017

Keywords

Comments

For n >= 11, this is the number of permutations of [n] that avoid substrings j(j+10), 1 <= j <= n-10.

Examples

			a(14)=64988179200 since this is the number of permutations in S14 that avoid substrings {1(11),2(12),3(13),4(14)}.
		

Crossrefs

Also 3628800 times A176736.
Cf. A068106.

Programs

  • Mathematica
    Table[Sum[(-1)^j*Binomial[n - 10, j]*(n - j)!, {j, 0, n - 10}], {n, 22}] (* Michael De Vlieger, Apr 03 2017 *)

Formula

For n>=11: a(n) = Sum_{j=0..n-10} (-1)^j*binomial(n-10,j)*(n-j)!.
Note a(n)/n! ~ 1/e.

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
Showing 1-10 of 22 results. Next