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.
%I A000255 M2905 N1166 #321 Jun 27 2025 19:16:10 %S A000255 1,1,3,11,53,309,2119,16687,148329,1468457,16019531,190899411, %T A000255 2467007773,34361893981,513137616783,8178130767479,138547156531409, %U A000255 2486151753313617,47106033220679059,939765362752547227,19690321886243846661,432292066866171724421 %N A000255 a(n) = n*a(n-1) + (n-1)*a(n-2), a(0) = 1, a(1) = 1. %C A000255 a(n) counts permutations of [1,...,n+1] having no substring [k,k+1]. - _Len Smiley_, Oct 13 2001 %C A000255 Also, for n > 0, determinant of the tridiagonal n X n matrix M such that M(i,i)=i and for i=1..n-1, M(i,i+1)=-1, M(i+1,i)=i. - Mario Catalani (mario.catalani(AT)unito.it), Feb 04 2003 %C A000255 Also, for n > 0, maximal permanent of a nonsingular n X n (0,1)-matrix, which is achieved by the matrix with just n-1 0's, all on main diagonal. [For proof, see next entry.] - _W. Edwin Clark_, Oct 28 2003 %C A000255 Proof from Richard Brualdi and _W. Edwin Clark_, Nov 15 2003: Let n >= 4. Take an n X n (0,1)-matrix A which is nonsingular. It has t >= n-1, 0's, otherwise there will be two rows of all 1's. Let B be the matrix obtained from A by replacing t-(n-1) of A's 0's with 1's. Let D be the matrix with all 1's except for 0's in the first n-1 positions on the diagonal. This matrix is easily seen to be non-singular. Now we have per(A) < = per(B) < = per (D), where the first inequality follows since replacing 0's by 1's cannot decrease the permanent and the second from Corollary 4.4 in the Brualdi et al. reference, which shows that per(D) is the maximum permanent of ANY n X n matrix with n -1 0's. Corollary 4.4 requires n >= 4. a(n) for n < 4 can be computed directly. %C A000255 With offset 1, permanent of (0,1)-matrix of size n X (n+d) with d=1 and n zeros not on a line. This is a special case of Theorem 2.3 of Seok-Zun Song et al., Extremes of permanents of (0,1)-matrices, pp. 201-202. - _Jaap Spies_, Dec 12 2003 %C A000255 Number of fixed-point-free permutations of n+2 that begin with a 2; e.g., for 1234, we have 2143, 2341, 2413, so a(2)=3. Also number of permutations of 2..n+2 that have no agreements with 1..n+1. E.g., for 123 against permutations of 234, we have 234, 342 and 432. Compare A047920. - _Jon Perry_, Jan 23 2004. [This can be proved by the standard argument establishing that d(n+2) = (n+1)(d(n+1)+d(n)) for derangements A000166 (n+1 choices of where 1 goes, then either 1 is in a transposition, or in a cycle of length at least 3, etc.). - D. G. Rogers, Aug 28 2006] %C A000255 Stirling transform of A006252(n+1)=[1,1,2,4,14,38,...] is a(n)=[1,3,11,53,309,...]. - _Michael Somos_, Mar 04 2004 %C A000255 a(n+1) is the sequence of numerators of the self-convergents to 1/(e-2); see A096654. - _Clark Kimberling_, Jul 01 2004 %C A000255 Euler's interpretation was "fixedpoint-free permutations beginning with 2" and he listed the terms up to 148329 (although he was blind at the time). - _Don Knuth_, Jan 25 2007 %C A000255 Equals lim_{k->infinity} A153869^k. - _Gary W. Adamson_, Jan 03 2009 %C A000255 Hankel transform is A059332. - _Paul Barry_, Apr 22 2009 %C A000255 This sequence appears in the analysis of Euler's divergent series 1 - 1! + 2! - 3! + 4! ... by Lacroix, see Hardy. For information about this and related divergent series see A163940. - _Johannes W. Meijer_, Oct 16 2009 %C A000255 a(n), n >= 1, enumerates also the ways to distribute n beads, labeled differently from 1 to n, over a set of (unordered) necklaces, excluding necklaces with exactly one bead, and one open cord allowed to have any number of beads. Each beadless necklace as well as the beadless cord contributes a factor 1 in the counting, e.g., a(0):=1*1=1. There are k! possibilities for the cord with k>=0 beads, which means that the two ends of the cord should be considered as fixed, in short: a fixed cord. This produces for a(n) the exponential (aka binomial) convolution of the sequences {n!=A000142(n)} and the subfactorials {A000166(n)}. %C A000255 See the formula below. Alternatively, the e.g.f. for this problem is seen to be (exp(-x)/(1-x))*(1/(1-x)), namely the product of the e.g.f.s for the subfactorials (from the unordered necklace problem, without necklaces with exactly one bead) and the factorials (from the fixed cord problem). Therefore the recurrence with inputs holds also. 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 02 2010 %C A000255 a(n) = (n-1)a(n-1) + (n-2)a(n-2) gives the same sequence offset by a 1. - _Jon Perry_, Sep 20 2012 %C A000255 Also, number of reduced 2 X (n+2) Latin rectangles. - _A.H.M. Smeets_, Nov 03 2013 %C A000255 Second column of Euler's difference table (second diagonal in example of A068106). - _Enrique Navarrete_, Dec 13 2016 %C A000255 If we partition the permutations of [n+2] in A000166 according to their starting digit, we will get (n+1) equinumerous classes each of size a(n) (the class starting with the digit 1 is empty since no derangement starts with 1). Hence, A000166(n+2)=(n+1)*a(n), so a(n) is the size of each nonempty class of permutations of [n+2] in A000166. For example, for n=3 we have 44=4*11 (see link). - _Enrique Navarrete_, Jan 11 2017 %C A000255 For n >= 1, the number of circular permutations (in cycle notation) on [n+2] that avoid substrings (j,j+2), 1 <= j <= n. For example, for n=2, the 3 circular permutations in S4 that avoid substrings {13,24} are (1234),(1423),(1432). Note that each of these circular permutations represent 4 permutations in one-line notation (see link 2017). - _Enrique Navarrete_, Feb 15 2017 %C A000255 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) holding for all n and k, which in turn is easily proved by induction making use of the given recurrences. - _Peter Bala_, Nov 21 2017 %C A000255 Number of permutations of [n] where the k-th fixed points are k-colored and all other points are unicolored. - _Alois P. Heinz_, Apr 28 2025 %D A000255 Richard A. Brualdi and Herbert J. Ryser, Combinatorial Matrix Theory, Camb. Univ. Press, 1991, Section 7.2, p. 202. %D A000255 Charalambos A. Charalambides, Enumerative Combinatorics, Chapman & Hall/CRC, Boca Raton, Florida, 2002, p. 179, Table 5.4 and p. 177 (5.1). %D A000255 CRC Handbook of Combinatorial Designs, 1996, p. 104. %D A000255 F. N. David, M. G. Kendall and D. E. Barton, Symmetric Function and Allied Tables, Cambridge, 1966, pp. 263-264. See Table 7.5.1, row 0; also Table 7.6.1, row 0. %D A000255 John Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p. 188. %D A000255 N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence). %D A000255 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence). %D A000255 N. Ya. Vilenkin, Combinatorics, pp. 54 - 56, Academic Press, 1971. Caravan in the Desert, E_n = a(n-1), n >= 1. %H A000255 T. D. Noe, <a href="/A000255/b000255.txt">Table of n, a(n) for n=0..100</a> %H A000255 M. H. Albert, M. D. Atkinson, and Robert Brignall, <a href="https://arxiv.org/abs/math/0603315">Permutation Classes of Polynomial Growth</a>, arXiv:math/0603315 [math.CO], 2006-2007; Annals of Combinatorics 11 (2007) 249-264. %H A000255 Per Alexandersson and Frether Getachew, <a href="https://arxiv.org/abs/2105.08455">An involution on derangements</a>, arXiv:2105.08455 [math.CO], 2021. %H A000255 Roland Bacher, <a href="https://doi.org/10.37236/2522">Counting Packings of Generic Subsets in Finite Groups</a>, Electr. J. Combinatorics, Vol. 19 (2012), Article P7. - From _N. J. A. Sloane_, Feb 06 2013 %H A000255 Barry Balof and Helen Jenne, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL17/Balof/balof22.html">Tilings, Continued Fractions, Derangements, Scramblings, and e</a>, Journal of Integer Sequences, Vol. 17 (2014), Article 14.2.7. %H A000255 Robert Brignall, Vít Jelínek, Jan Kynčl, and David Marchant, <a href="https://arxiv.org/abs/1810.05449">Zeros of the Möbius function of permutations</a>, arXiv:1810.05449 [math.CO], 2018. %H A000255 Richard A. Brualdi, John L. Goldwasser, and T. S. Michael, <a href="http://dx.doi.org/10.1016/0097-3165(88)90019-2">Maximum permanents of matrices of zeros and ones</a>, J. Combin. Theory Ser. A 47 (1988), 207-245. %H A000255 Giulio Cerbai and Luca Ferrari, <a href="https://arxiv.org/abs/1808.02653">Permutation patterns in genome rearrangement problems</a>, arXiv:1808.02653 [math.CO], 2018. See p. 126. %H A000255 Shane Chern, Lin Jiu, and Italo Simonelli, <a href="https://arxiv.org/abs/2309.08841">A central limit theorem for a card shuffling problem</a>, arXiv:2309.08841 [math.PR], 2023. %H A000255 Leonhard Euler, <a href="https://scholarlycommons.pacific.edu/euler-works/530/">Recherches sur une nouvelle espèce des quarrés magiques</a>, Verhandelingen uitgegeven door het zeeuwsch Genootschap der Wetenschappen te Vlissingen, 9 (1782), 85-239, on page 235 in section 152. This is paper E530 in Enestrom's index of Euler's works. The sequence appears on page 389 of Euler's Opera Omnia, series I, volume 7. [From D. E. Knuth] %H A000255 Uriel Feige, <a href="http://www.wisdom.weizmann.ac.il/~feige/mypapers/OnlineMatchingFeige2018.pdf">Tighter bounds for online bipartite matching</a>, 2018. %H A000255 Philip Feinsilver and John McSorley, <a href="http://dx.doi.org/10.1155/2011/539030">Zeons, Permanents, the Johnson Scheme, and Generalized Derangements</a>, International Journal of Combinatorics, Volume 2011, Article ID 539030, 29 pages; doi:10.1155/2011/539030. %H A000255 Philippe Flajolet and Robert Sedgewick, <a href="http://algo.inria.fr/flajolet/Publications/books.html">Analytic Combinatorics</a>, 2009; see page 373. %H A000255 Hannah Golab, <a href="http://danaernst.com/scholarship/GolabThesis.pdf">Pattern avoidance in Cayley permutations</a>, Master's Thesis, Northern Arizona Univ. (2024). See p. 36. %H A000255 G. H. Hardy, <a href="http://www.archive.org/details/divergentseries033523mbp">Divergent Series</a>, Oxford University Press, 1949. p. 29. %H A000255 Florian Herzig, <a href="https://cms.math.ca/publications/crux/issue?volume=24&issue=3">Problem 2330</a>, Crux Mathematicorum, Vol. 24, No. 3 (1998), p. 176; <a href="https://cms.math.ca/publications/crux/issue?volume=25&issue=3">Solution to Problem 2330</a>, by Con Amore Problem Group, ibid., Vol. 25, No. 3 (1999), pp. 183-185. %H A000255 F. Hivert, J.-C. Novelli and J.-Y. Thibon, <a href="https://arxiv.org/abs/math/0605262">Commutative combinatorial Hopf algebras</a>, arXiv:math/0605262 [math.CO], 2006. %H A000255 Brian Hopkins, <a href="http://ecajournal.haifa.ac.il/Volume2021/ECA2021_S1H1.pdf">Euler's Enumerations</a>, Enumerative Combinatorics and Applications, Vol. 1, No. 1 (2021), Article #S1H1. %H A000255 Helen K. Jenne, <a href="https://www.whitman.edu/Documents/Academics/Mathematics/Jenne.pdf">Proofs you can count on</a>, Honors Thesis, Math. Dept., Whitman College, 2013. %H A000255 G. Kreweras, <a href="https://web.archive.org/web/2024*/https://www.fq.math.ca/Scanned/18-3/kreweras.pdf">The number of more or less "regular" permutations</a>, Fib. Quart., Vol. 18, No. 3 (1980), pp. 226-229. %H A000255 Ajay Kumar and Chanchal Kumar, <a href="https://www.ias.ac.in/public/Volumes/pmsc/forthcoming/PMSC-D-17-00160.pdf">Monomial ideals induced by permutations avoiding patterns</a>, 2018. %H A000255 Toufik Mansour and Mark Shattuck, <a href="http://dx.doi.org/10.1016/j.disc.2015.12.004">Counting permutations by the number of successors within cycles</a>, Discr. Math., Vol. 339, No. 4 (2016), pp. 1368-1376. %H A000255 A. N. Myers, <a href="http://dx.doi.org/10.1006/jcta.2002.3279">Counting permutations by their rigid patterns</a>, J. Combin. Theory, Series A, Vol. 99, No. 2 (2002), pp. 345-357. %H A000255 Enrique Navarrete, <a href="https://arxiv.org/abs/1610.01987">Forbidden Patterns and the Alternating Derangement Sequence</a>, arXiv:1610.01987 [math.CO], 2016. %H A000255 Enrique Navarrete, <a href="https://arxiv.org/abs/1702.02637">Forbidden Substrings in Circular K-Successions</a>, arXiv:1702.02637 [math.CO], 2017. %H A000255 Luis Manuel Rivera, <a href="http://arxiv.org/abs/1406.3081">Integer sequences and k-commuting permutations</a>, arXiv preprint arXiv:1406.3081 [math.CO], 2014. %H A000255 D. P. Roselle, <a href="http://dx.doi.org/10.1090/S0002-9939-1968-0218256-9">Permutations by number of rises and successions</a>, Proc. Amer. Math. Soc., Vol. 19, No. 1 (1968), pp. 8-16. %H A000255 D. P. Roselle, <a href="/A046739/a046739.pdf"> Permutations by number of rises and successions</a>, Proc. Amer. Math. Soc., Vol. 19, No. 1 (1968), pp. 8-16. [Annotated scanned copy] %H A000255 Max Rumney and E. J. F. Primrose, <a href="http://www.jstor.org/stable/3611860">A sequence connected with the subfactorial sequence, Note 3207</a>, Math. Gaz., Vol. 52, No. 382 (1968), pp. 381-382. %H A000255 Max Rumney and E. J. F. Primrose, <a href="/A000255/a000255.pdf">A sequence connected with the subfactorial sequence</a>, Note 3207, Math. Gaz., Vol. 52, No. 382 (1968), pp. 381-382. [Annotated scanned copy] %H A000255 Isaac Sofair, <a href="http://dx.doi.org/10.1017/S0025557200000176">Derangement revisited</a>, Math. Gazette, Vol. 97, No. 540 (2013), pp. 435-440. %H A000255 Seok-Zun Song et al., <a href="http://dx.doi.org/10.1016/S0024-3795(03)00382-3">Extremes of permanents of (0,1)-matrices</a>, Lin. Algebra and its Applic., Vol. 373 (2003), pp. 197-210. %H A000255 Jun Yan, <a href="https://arxiv.org/abs/2404.07958">Results on pattern avoidance in parking functions</a>, arXiv:2404.07958 [math.CO], 2024. See p. 5. %F A000255 E.g.f.: exp(-x)/(1-x)^2. %F A000255 a(n) = Sum_{k=0..n} (-1)^k * (n-k+1) * n!/k!. - _Len Smiley_ %F A000255 Inverse binomial transform of (n+1)!. - Robert A. Stump (bee_ess107(AT)yahoo.com), Dec 09 2001 %F A000255 a(n-2) = !n/(n - 1) where !n is the subfactorial of n, A000166(n). - _Lekraj Beedassy_, Jun 18 2002 %F A000255 a(n) = floor((1/e)*n!*(n+2)+1/2). - _Benoit Cloitre_, Jan 15 2004 %F A000255 Apparently lim_{n->infinity} log(n) - log(a(n))/n = 1. - _Gerald McGarvey_, Jun 12 2004 %F A000255 a(n) = (n*(n+2)*a(n-1) + (-1)^n)/(n+1) for n >= 1, a(0)=1. See the Charalambides reference. %F A000255 a(n) = GAMMA(n+3,-1)*exp(-1)/(n+1) (incomplete Gamma function). - _Mark van Hoeij_, Nov 11 2009 %F A000255 a(n) = A000166(n) + A000166(n+1). %F A000255 A002469(n) = (n-2)*a(n-1) + A000166(n). - _Gary W. Adamson_, Apr 17 2009 %F A000255 If we take b(n) = (-1)^(n+1)*a(n) for n > 0, then for n > 1 the arithmetic mean of the first n terms is -b(n-1). - _Franklin T. Adams-Watters_, May 20 2010 %F A000255 a(n) = hypergeometric([2,-n],[],1)*(-1)^n = KummerU(2,3+n,-1)*(-1)^n. See the Abramowitz-Stegun handbook (for the reference see e.g. A103921) p. 504, 13.1.10, and for the recurrence p. 507, 13.4.16. - _Wolfdieter Lang_, May 20 2010 %F A000255 a(n) = n!*(1 + Sum_{k=0..n-2} sf(n-k)/(n-k)!) with the subfactorials sf(n):= A000166(n) (this follows from the exponential convolution). - _Wolfdieter Lang_, Jun 02 2010 %F A000255 a(n) = 1/(n+1)*floor(((n+1)!+1)/e). - _Gary Detlefs_, Jul 11 2010 %F A000255 a(n) = (Subfactorial(n+2))/(n+1). - _Alexander R. Povolotsky_, Jan 26 2011 %F A000255 G.f.: 1/(1-x-2x^2/(1-3x-6x^2/(1-5x-12x^2/(1-7x-20x^2/(1-.../(1-(2n+1)x-(n+1)(n+2)x^2/(1-... (continued fraction). - _Paul Barry_, Apr 11 2011 %F A000255 G.f.: hypergeom([1,2],[],x/(x+1))/(x+1). - _Mark van Hoeij_, Nov 07 2011 %F A000255 From _Sergei N. Gladkovskii_, Sep 24 2012 - Feb 05 2014: (Start) %F A000255 Continued fractions: %F A000255 E.g.f. 1/E(0) where E(k) = 1 - 2*x/(1 + x/(2 - x - 2/(1 + x*(k+1)/E(k+1)))). %F A000255 G.f.: S(x)/x - 1/x = Q(0)/x - 1/x where S(x) = Sum_{k>=0} k!*(x/(1+x))^k, Q(k) = 1 + (2*k + 1)*x/(1 + x - 2*x*(1+x)*(k+1)/(2*x*(k+1) + (1+x)/Q(k+1))). %F A000255 G.f.: 1/Q(0) where Q(k) = 1 + x - x*(k+2)/(1 - x*(k+1)/Q(k+1)). %F A000255 G.f.: 1/x/Q(0) where Q(k) = 1/x - (2*k+1) - (k+2)*(k+1)/Q(k+1). %F A000255 G.f.: (1+x)/(x*Q(0)) - 1/x where Q(k) = 1 - 2*k*x - x^2*(k + 1)^2/Q(k+1). %F A000255 G.f.: 2/x/G(0) - 1/x where G(k) = 1 + 1/(1 - x*(2*k+2)/(x*(2*k+1) - 1 + x*(2*k+2)/ G(k+1))). %F A000255 G.f.: ((Sum_{k>=0} k!*(x/(1+x))^k) - 1)/x = Q(0)/(2*x) - 1/x where Q(k) = 1 + 1/(1 - x*(k+1)/(x*(k+1) + (1+x)/Q(k+1))). %F A000255 G.f.: W(0) where W(k) = 1 - x*(k+1)/(x*(k+1) - 1/(1 - x*(k+2)/(x*(k+1) - 1/W(k+1)))). %F A000255 G.f.: G(0)/(1-x) where G(k) = 1 - x^2*(k+1)*(k+2)/(x^2*(k+1)*(k+2) - (1-x*(1+2*k))*(1-x*(3+2*k))/G(k+1)). (End) %F A000255 From _Peter Bala_, Sep 20 2013: (Start) %F A000255 The sequence b(n) := n!*(n + 2) satisfies the defining recurrence for a(n) but with the starting values b(0) = 2 and b(1) = 3. This leads to the finite continued fraction expansion a(n) = n!*(n+2)*( 1/(2 + 1/(1 + 1/(2 + 2/(3 + ... + (n-1)/n)))) ), valid for n >= 2. %F A000255 Also a(n) = n!*(n+2)*( Sum_{k = 0..n} (-1)^k/(k+2)! ). Letting n -> infinity gives the infinite continued fraction expansion 1/e = 1/(2 + 1/(1 + 1/(2 + 2/(3 + ... + (n-1)/(n + ...)))) ) due to Euler. (End) %F A000255 0 = a(n)*(+a(n+1) + 2*a(n+2) - a(n+3)) + a(n+1)*(+2*a(n+2) - a(n+3)) + a(n+2)*(+a(n+2)) if n >= 0. - _Michael Somos_, May 06 2014 %F A000255 a(n-3) = (n-2)*A000757(n-2) + (2*n-5)*A000757(n-3) + (n-3)*A000757(n-4), n >= 3. - _Luis Manuel Rivera Martínez_, Mar 14 2015 %F A000255 a(n) = A000240(n) + A000240(n+1), n >= 1. Let D(n) = A000240(n) be the permutations of [n] having no substring in {12,23,...,(n-1)n,n1}. Let d(n) = a(n-1) be the permutations of [n] having no substring in {12,23,...,(n-1)n}. Let d_n1 = A000240(n-1) be the permutations of [n] that have the substring n1 but no substring in {12,23,...,(n-1)n}. Then the link "Forbidden Patterns" shows the bijection d_n1 ~ D(n-1) and since dn = d_n1 U D(n), we get dn = D(n-1) U D(n). Taking cardinalities we get the result for n-1, i.e., a(n-1) = A000240(n-1) + A000240(n). For example, for n=4 in this last equation, we get a(4) = 11 = 3+8. - _Enrique Navarrete_, Jan 16 2017 %F A000255 a(n) = (n+1)!*hypergeom([-n], [-n-1], -1). - _Peter Luschny_, Nov 02 2018 %F A000255 Sum_{n>=0} (-1)^n*n!/(a(n)*a(n+1)) = e - 2 (Herzig, 1998). - _Amiram Eldar_, Mar 07 2022 %F A000255 a(n) = KummerU(-n, -n - 1, -1). - _Peter Luschny_, May 10 2022 %e A000255 a(3)=11: 1 3 2 4; 1 4 3 2; 2 1 4 3; 2 4 1 3; 3 2 1 4; 3 2 4 1; 4 1 3 2; 4 2 1 3; 4 3 2 1; 2 4 3 1; 3 1 4 2. The last two correspond to (n-1)*a(n-2) since they contain a [j,n+1,j+1]. %e A000255 Cord-necklaces problem. For n=4 one considers the following weak two part compositions of 4: (4,0), (2,2), (1,3), and (0,4), where (3,1) does not appear because there are no necklaces with 1 bead. These compositions contribute respectively 4!*1, (binomial(4,2)*2)*sf(2), (binomial(4,1)*1)*sf(3), and 1*sf(4) with the subfactorials sf(n):=A000166(n) (see the necklace comment there). This adds up as 24 + 6*2 + 4*2 + 9 = 53 = a(4). - _Wolfdieter Lang_, Jun 02 2010 %e A000255 G.f. = 1 + x + 3*x^2 + 11*x^3 + 53*x^4 + 309*x^5 + 2119*x^6 + 16687*x^7 + ... %p A000255 a := n -> hypergeom([2,-n], [], 1)*(-1)^n: %p A000255 seq(simplify(a(n)), n=0..19); # _Peter Luschny_, Sep 20 2014 %p A000255 seq(simplify(KummerU(-n, -n-1, -1)), n=0..21); # _Peter Luschny_, May 10 2022 %t A000255 c = CoefficientList[Series[Exp[ -z]/(1 - z)^2, {z, 0, 30}], z]; For[n = 0, n < 31, n++; Print[c[[n]]*(n - 1)! ]] %t A000255 Table[Subfactorial[n] + Subfactorial[n + 1], {n, 0, 20}] (* _Zerinvary Lajos_, Jul 09 2009 *) %t A000255 RecurrenceTable[{a[n]==n a[n-1]+(n-1)a[n-2],a[0]==1,a[1]==1},a[n], {n,20}] (* _Harvey P. Dale_, May 10 2011 *) %t A000255 a[ n_] := If[ n < 0, 0, Round[ n! (n + 2) / E]] (* _Michael Somos_, Jun 01 2013 *) %t A000255 a[ n_] := If[ n < 0, 0, n! SeriesCoefficient[ Exp[ -x] / (1 - x)^2, {x, 0, n}]] (* _Michael Somos_, Jun 01 2013 *) %t A000255 a[ n_] := If[ n < 0, 0, (-1)^n HypergeometricPFQ[ {- n, 2}, {}, 1]] (* _Michael Somos_, Jun 01 2013 *) %t A000255 sa[k_Integer]/;k>=2 := SparseArray[{{i_, i_} -> i, Band[{2, 1}] -> -1, {i_, j_} /; (i == j - 1) :> i}, {k, k}]; {1, 1}~Join~Array[Det[sa[#]] &, 20, 2] (* _Shenghui Yang_, Oct 15 2024 *) %o A000255 (PARI) {a(n) = if( n<0, 0, contfracpnqn( matrix( 2, n, i, j, j - (i==1)))[1, 1])}; %o A000255 (PARI) {a(n) = if( n<0, 0, n! * polcoeff( exp( -x + x * O(x^n)) / (1 - x)^2, n))}; %o A000255 (Sage) from sage.combinat.sloane_functions import ExtremesOfPermanentsSequence2 %o A000255 e = ExtremesOfPermanentsSequence2() %o A000255 it = e.gen(1,1,1) %o A000255 [next(it) for i in range(20)] %o A000255 # _Zerinvary Lajos_, May 15 2009 %o A000255 (Haskell) %o A000255 a000255 n = a000255_list !! n %o A000255 a000255_list = 1 : 1 : zipWith (+) zs (tail zs) where %o A000255 zs = zipWith (*) [1..] a000255_list %o A000255 -- _Reinhard Zumkeller_, Dec 05 2011 %o A000255 (Magma) I:=[1, 3]; [1] cat [n le 2 select I[n] else n*Self(n-1)+(n-1)*Self(n-2): n in [1..30]]; // _Vincenzo Librandi_, Aug 09 2018 %Y A000255 Row sums of triangle in A046740. A diagonal of triangle in A068106. %Y A000255 Cf. A000153, A000166, A000261, A001909, A001910, A055790. %Y A000255 Cf. A090010, A090012, A090013, A090014, A090015, A090016. %Y A000255 A052655 gives occurrence count for non-singular (0, 1)-matrices with maximal permanent, A089475 number of different values of permanent, A089480 occurrence counts for permanents all non-singular (0, 1)-matrices, A087982, A087983. %Y A000255 A diagonal in triangle A010027. %Y A000255 Cf. A153869, A159610, A002469. %Y A000255 a(n) = A086764(n+1,1). %K A000255 nonn,easy,nice %O A000255 0,3 %A A000255 _N. J. A. Sloane_