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

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

A000179 Ménage numbers: a(0) = 1, a(1) = -1, and for n >= 2, a(n) = number of permutations s of [0, ..., n-1] such that s(i) != i and s(i) != i+1 (mod n) for all i.

Original entry on oeis.org

1, -1, 0, 1, 2, 13, 80, 579, 4738, 43387, 439792, 4890741, 59216642, 775596313, 10927434464, 164806435783, 2649391469058, 45226435601207, 817056406224416, 15574618910994665, 312400218671253762, 6577618644576902053, 145051250421230224304, 3343382818203784146955, 80399425364623070680706, 2013619745874493923699123
Offset: 0

Views

Author

Keywords

Comments

According to rook theory, John Riordan considered a(1) to be -1. - Vladimir Shevelev, Apr 02 2010
This is also the value that the formulas of Touchard and of Wyman and Moser give and is compatible with many recurrences. - William P. Orrick, Aug 31 2020
Or, for n >= 3, the number of 3 X n Latin rectangles the second row of which is full cycle with a fixed order of its elements, e.g., the cycle (x_2,x_3,...,x_n,x_1) with x_1 < x_2 < ... < x_n. - Vladimir Shevelev, Mar 22 2010
Muir (p. 112) gives essentially this recurrence (although without specifying any initial conditions). Compare A186638. - N. J. A. Sloane, Feb 24 2011
Sequence discovered by Touchard in 1934. - L. Edson Jeffery, Nov 13 2013
Although these are also known as Touchard numbers, the problem was formulated by Lucas in 1891, who gave the recurrence formula shown below. See Cerasoli et al., 1988. - Stanislav Sykora, Mar 14 2014
An equivalent problem was formulated by Tait; solutions to Tait's problem were given by Muir (1878) and Cayley (1878). - William P. Orrick, Aug 31 2020
From Vladimir Shevelev, Jun 25 2015: (Start)
According to the ménage problem, 2*n!*a(n) is the number of ways of seating n married couples at 2*n chairs around a circular table, men and women in alternate positions, so that no husband is next to his wife.
It is known [Riordan, ch. 7] that a(n) is the number of arrangements of n non-attacking rooks on the positions of the 1's in an n X n (0,1)-matrix A_n with 0's in positions (i,i), i = 1,...,n, (i,i+1), i = 1,...,n-1, and (n,1). This statement could be written as a(n) = per(A_n). For example, A_5 has the form
001*11
1*0011
11001* (1)
11*100
0111*0,
where 5 non-attacking rooks are denoted by {1*}.
We can indicate a one-to-one correspondence between arrangements of n non-attacking rooks on the 1's of a matrix A_n and arrangements of n married couples around a circular table by the rules of the ménage problem, after the ladies w_1, w_2, ..., w_n have taken the chairs numbered
2*n, 2, 4, ..., 2*n-2 (2)
respectively. Suppose we consider an arrangement of rooks: (1,j_1), (2,j_2), ..., (n,j_n). Then the men m_1, m_2, ..., m_n took chairs with numbers
2*j_i - 3 (mod 2*n), (3)
where the residues are chosen from the interval[1,2*n]. Indeed {j_i} is a permutation of 1,...,n. So {2*j_i-3}(mod 2*n) is a permutation of odd positive integers <= 2*n-1. Besides, the distance between m_i and w_i cannot be 1. Indeed, the equality |2*(j_i-i)-1| = 1 (mod 2*n) is possible if and only if either j_i=i or j_i=i+1 (mod n) that correspond to positions of 0's in matrix A_n.
For example, in the case of positions of {1*} in(1) we have j_1=3, j_2=1, j_3=5, j_4=2, j_5=4. So, by(2) and (3) the chairs 1,2,...,10 are taken by m_4, w_2, m_1, w_3, m_5, w_4, m_3, w_5, m_2, w_1, respectively. (End)
The first 20 terms of this sequence were calculated in 1891 by E. Lucas (see [Lucas, p. 495]). - Peter J. C. Moses, Jun 26 2015
From Ira M. Gessel, Nov 27 2018: (Start)
If we invert the formula
Sum_{ n>=0 } u_n z^n = ((1-z)/(1+z)) F(z/(1+z)^2)
that Don Knuth mentions (see link) (i.e., set x=z/(1+z)^2 and solve for z in terms of x), we get a formula for F(z) = Sum_{n >= 0} n! z^n as a sum with all positive coefficients of (almost) powers of the Catalan number generating function.
The exact formula is (5) of the Yiting Li article.
This article also gives a combinatorial proof of this formula (though it is not as simple as one might want). (End)

Examples

			a(2) = 0; nothing works. a(3) = 1; (201) works. a(4) = 2; (2301), (3012) work. a(5) = 13; (20413), (23401), (24013), (24103), (30412), (30421), (34012), (34021), (34102), (40123), (43012), (43021), (43102) work.
		

References

  • W. W. R. Ball and H. S. M. Coxeter, Mathematical Recreations and Essays, 13th Ed. Dover, p. 50.
  • M. Cerasoli, F. Eugeni and M. Protasi, Elementi di Matematica Discreta, Nicola Zanichelli Editore, Bologna 1988, Chapter 3, p. 78.
  • L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 185, mu(n).
  • Kaplansky, Irving and Riordan, John, The probleme des menages, Scripta Math. 12, (1946). 113-124. See u_n.
  • E. Lucas, Théorie des nombres, Paris, 1891, pp. 491-495.
  • P. A. MacMahon, Combinatory Analysis. Cambridge Univ. Press, London and New York, Vol. 1, 1915 and Vol. 2, 1916; see vol. 1, p 256.
  • T. Muir, A Treatise on the Theory of Determinants. Dover, NY, 1960, Sect. 132, p. 112. - N. J. A. Sloane, Feb 24 2011
  • J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p. 197.
  • V. S. Shevelev, Reduced Latin rectangles and square matrices with equal row and column sums, Diskr. Mat. (J. of the Akademy of Sciences of Russia) 4(1992), 91-110. - Vladimir Shevelev, Mar 22 2010
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • H. M. Taylor, A problem on arrangements, Mess. Math., 32 (1902), 60ff.
  • J. Touchard, Permutations discordant with two given permutations, Scripta Math., 19 (1953), 108-119.
  • J. H. van Lint, Combinatorial Theory Seminar, Eindhoven University of Technology, Springer Lecture Notes in Mathematics, Vol. 382, 1974. See page 10.

Crossrefs

Diagonal of A058087. Also a diagonal of A008305.
A000179, A102761, and A335700 are all essentially the same sequence but with different conventions for the initial terms a(0) and a(1). - N. J. A. Sloane, Aug 06 2020

Programs

  • Haskell
    import Data.List (zipWith5)
    a000179 n = a000179_list !! n
    a000179_list = 1 : -1 : 0 : 1 : zipWith5
       (\v w x y z -> (x * y + (v + 2) * z - w) `div` v) [2..] (cycle [4,-4])
       (drop 4 a067998_list) (drop 3 a000179_list) (drop 2 a000179_list)
    -- Reinhard Zumkeller, Aug 26 2013
    
  • Maple
    A000179:= n ->add ((-1)^k*(2*n)*binomial(2*n-k,k)*(n-k)!/(2*n-k), k=0..n); # for n >= 1
    U:= proc(n) local k; add( (2*n/(2*n-k))*binomial(2*n-k,k)*(n-k)!*(x-1)^k, k=0..n); end; W := proc(r,s) coeff( U(r),x,s ); end; A000179 := n->W(n,0); # valid for n >= 1
  • Mathematica
    a[n_] := 2*n*Sum[(-1)^k*Binomial[2*n - k, k]*(n - k)!/(2*n - k), {k, 0, n}]; a[0] = 1; Table[a[n], {n, 0, 21}] (* Jean-François Alcover, Dec 05 2012, from 2nd formula *)
  • PARI
    \\ 3 programs adapted to a(1) = -1 by Hugo Pfoertner, Aug 31 2020
    
  • PARI
    {a(n) = my(A); if( n, A = vector(n,i,i-2); for(k=4, n, A[k] = (k * (k - 2) * A[k-1] + k * A[k-2] - 4 * (-1)^k) / (k-2)); A[n], 1)};/* Michael Somos, Jan 22 2008 */
    
  • PARI
    a(n)=if(n>1, round(2*n*exp(-2)*besselk(n, 2)), 1-2*n) \\ Charles R Greathouse IV, Nov 03 2014
    
  • PARI
    {a(n) = my(A); if( n, A = vector(n,i,i-2); for(k=5, n, A[k] = k * A[k-1] + 2 * A[k-2] + (4-k) * A[k-3] - A[k-4]); A[n], 1)} /* Michael Somos, May 02 2018 */
    
  • Python
    from math import comb, factorial
    def A000179(n): return 1 if n == 0 else sum((-2*n if k & 1 else 2*n)*comb(m:=2*n-k,k)*factorial(n-k)//m for k in range(n+1)) # Chai Wah Wu, May 27 2022

Formula

a(n) = ((n^2-2*n)*a(n-1) + n*a(n-2) - 4*(-1)^n)/(n-2) for n >= 3.
a(n) = A059375(n)/(2*n!) for n >= 2.
a(n) = Sum_{k=0..n} (-1)^k*(2*n)*binomial(2*n-k, k)*(n-k)!/(2*n-k) for n >= 1. - Touchard (1934)
G.f.: ((1-x)/(1+x))*Sum_{n>=0} n!*(x/(1+x)^2)^n. - Vladeta Jovovic, Jun 26 2007
a(2^k+2) == 0 (mod 2^k); for k >= 2, a(2^k) == 2(mod 2^k). - Vladimir Shevelev, Jan 14 2011
a(n) = round( 2*n*exp(-2)*BesselK(n,2) ) for n > 1. - Mark van Hoeij, Oct 25 2011
a(n) ~ (n/e)^n * sqrt(2*Pi*n)/e^2. - Charles R Greathouse IV, Jan 21 2016
0 = a(n)*(-a(n+2) +a(n+4)) +a(n+1)*(+a(n+1) +a(n+2) -3*a(n+3) -5*a(n+4) +a(n+5)) +a(n+2)*(+2*a(n+2) +3*a(n+3) -3*a(n+4)) +a(n+3)*(+2*a(n+3) +a(n+4) -a(n+5)) +a(n+4)*(+a(n+4)), for all n>1. If a(-2..1) = (0, -1, 2, -1) then also true for those values of n. - Michael Somos, Apr 29 2018
D-finite with recurrence: 0 = a(n) +n*a(n+1) -2*a(n+2) +(-n-4)*a(n+3) +a(n+4), for all n in Z where a(n) = a(-n) for all n in Z and a(0) = 2, a(1) = -1. - Michael Somos, May 02 2018
a(n) = Sum_{k=0..n} A213234(n,k) * A000023(n-2*k) = Sum_{k=0..n} (-1)^k * n/(n-k) * binomial(n-k, k) * (n-2*k)! Sum_{j=0..n-2*k} (-2)^j/j! for n >= 1. [Wyman and Moser (1958)]. - William P. Orrick, Jun 25 2020
a(k+4*p) - 2*a(k+2*p) + a(k) is divisible by p, for any k > 0 and any prime p. - Mark van Hoeij, Jan 11 2022

Extensions

More terms from James Sellers, May 02 2000
Additional comments from David W. Wilson, Feb 18 2003
a(1) changed to -1 at the suggestion of Don Knuth. - N. J. A. Sloane, Nov 26 2018

A324563 Number T(n,k) of permutations p of [n] such that k is the maximum of 0 and the number of elements in any integer interval [p(i)..i+n*[i=0, 0<=k<=n, read by rows.

Original entry on oeis.org

1, 0, 1, 0, 1, 1, 0, 1, 1, 4, 0, 1, 1, 7, 15, 0, 1, 1, 11, 31, 76, 0, 1, 1, 18, 60, 185, 455, 0, 1, 1, 29, 113, 435, 1275, 3186, 0, 1, 1, 47, 215, 1001, 3473, 10095, 25487, 0, 1, 1, 76, 406, 2299, 9289, 31315, 90109, 229384, 0, 1, 1, 123, 763, 5320, 24610, 95747, 313227, 895169, 2293839
Offset: 0

Views

Author

Alois P. Heinz, Mar 06 2019

Keywords

Comments

Mirror image of triangle A324564.
Or as array: Number A(n,k) of permutations p of [n+k] such that k is the maximum of 0 and the number of elements in any integer interval [p(i)..i+(n+k)*[i=0, k>=0, read by antidiagonals upwards.

Examples

			T(4,1) = A(3,1) = 1: 1234.
T(4,2) = A(2,2) = 1: 4123.
T(4,3) = A(1,3) = 7: 1423, 1432, 3124, 3214, 3412, 4132, 4213.
T(4,4) = A(0,4) = 15: 1243, 1324, 1342, 2134, 2143, 2314, 2341, 2413, 2431, 3142, 3241, 3421, 4231, 4312, 4321.
Triangle T(n,k) begins:
  1;
  0, 1;
  0, 1, 1;
  0, 1, 1,  4;
  0, 1, 1,  7,  15;
  0, 1, 1, 11,  31,   76;
  0, 1, 1, 18,  60,  185,   455;
  0, 1, 1, 29, 113,  435,  1275,   3186;
  0, 1, 1, 47, 215, 1001,  3473,  10095, 25487;
  ...
Square array A(n,k) begins:
  1, 1, 1,  4,  15,   76,   455,   3186, ...
  0, 1, 1,  7,  31,  185,  1275,  10095, ...
  0, 1, 1, 11,  60,  435,  3473,  31315, ...
  0, 1, 1, 18, 113, 1001,  9289,  95747, ...
  0, 1, 1, 29, 215, 2299, 24610, 290203, ...
  0, 1, 1, 47, 406, 5320, 65209, 876865, ...
  ...
		

Crossrefs

Columns k=0, (1+2), 3-10 give: A000007, A000012, A000032 (for n>=3), A324631, A324632, A324633, A324634, A324635, A324636, A324637.
Diagonals of the triangle (rows of the array) n=0-10 give: A002467 (for k>0), A324621, A324622, A324623, A324624, A324625, A324626, A324627, A324628, A324629, A324630.
Row sums give A000142.
T(2n,n) or A(n,n) gives A324638.

Programs

  • Maple
    b:= proc(n, k) option remember; `if`(n=k, n!,
           LinearAlgebra[Permanent](Matrix(n, (i, j)->
          `if`(i<=j and j b(n, k)-`if`(k=0, 0, b(n, k-1)):
    seq(seq(T(n, k), k=0..n), n=0..10);
    # as array:
    A:= (n, k)-> b(n+k, k)-`if`(k=0, 0, b(n+k, k-1)):
    seq(seq(A(d-k, k), k=0..d), d=0..10);
  • Mathematica
    b[n_, k_] := b[n, k] = If[n == k, n!, Permanent[Table[If[i <= j && j < k + i || n + j < k + i, 1, 0], {i, 1, n}, {j, 1, n}]]];
    (* as triangle: *)
    T[n_, k_] := b[n, k] - If[k == 0, 0, b[n, k - 1]]; Table[T[n, k], {n, 0, 10}, {k, 0, n}] // Flatten
    (* as array: *)
    A[n_, k_] := b[n + k, k] - If[k == 0, 0, b[n + k, k - 1]]; Table[A[d - k, k], {d, 0, 10}, {k, 0, d}] // Flatten (* Jean-François Alcover, May 08 2019, after Alois P. Heinz *)

Formula

T(n,k) = |{ p in S_n : k = max_{i=1..n} (1+i-p(i)+n*[i0, T(0,0) = 1.
T(n,k) = A008305(n,k) - A008305(n,k-1) for k > 0, T(n,0) = A000007(n).

A000183 Number of discordant permutations of length n.

Original entry on oeis.org

0, 0, 0, 1, 2, 20, 144, 1265, 12072, 126565, 1445100, 17875140, 238282730, 3407118041, 52034548064, 845569542593, 14570246018686, 265397214435860, 5095853023109484, 102877234050493609, 2178674876680100744, 48296053720501168037, 1118480911876659396600
Offset: 1

Views

Author

Keywords

Comments

Ways to reseat n diners at circular table, none in or next to original chair.

Examples

			a(5) = 2: [ 1 2 3 4 5 ] -> [ 3 4 5 1 2 ] or [ 4 5 1 2 3 ].
Let n=7. Then, using the previous values of a(n), we have a(7) = -(4*7+31) + (7/6)*(8*20-2*20) - (14/5)*(4*2-13) + (7/4)*(2*1+2*9) + (7/3)*6 = -59+140+14+35+14 = 144. - _Vladimir Shevelev_, Apr 17 2011
		

References

  • J. Riordan, Discordant permutations, Scripta Math., 20 (1954), 14-23.
  • 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).
  • R. P. Stanley, Enumerative Combinatorics I, Example 4.7.17.
  • K. Yamamoto, Structure polynomial of Latin rectangles and its application to a combinatorial problem, Memoirs of the Faculty of Science, Kyusyu University, Series A, 10 (1956), 1-13.

Crossrefs

Programs

  • Maple
    with(combinat): f:= n-> fibonacci(n-1) +fibonacci(n+1) +2:
    a:= proc(n) option remember; `if` (n<7, [0$3, 1, 2, 20][n], (-1)^n*(4*n+f(n)) +(n/(n-1))*((n+1)*a(n-1) +2*(-1)^n*f(n-1)) -((2*n)/(n-2))*((n-3)*a(n-2) +(-1)^n*f(n-2)) +(n/(n-3))*((n-5)*a(n-3) +2*(-1)^(n-1)*f(n-3)) +(n/(n-4))*(a(n-4) +(-1)^(n-1)*f(n-4))) end:
    seq(a(n), n=1..30);  # Alois P. Heinz, Apr 19 2011
  • Mathematica
    max = 22; f[x_, y_] := y*(1 + 3*x - 4*x^2*y - 3*x^2*y^2 - 3*x^3*y^2 + 4*x^4*y^3)/((1 - y - 2*x*y - x*y^2 + x^3*y^3)*(1 - x*y)); se = Series[f[x, y], {x, 0, max}, {y, 0, max}];coes = CoefficientList[se, {x, y}] ;t[n_, k_] := coes[[k, n]]; a[n_] := Sum[ (-1)^(k+1)*(n-k+1)!*t[n+1, k], {k, 1, n+1}]; a[1] = a[2] = a[3] = 0; Table[a[n], {n, 1, max}] (* Jean-François Alcover, Oct 24 2011 *)
    Flatten[{0,0,RecurrenceTable[{(382-1142 n+712 n^2-185 n^3+22 n^4-n^5) a[-7+n]+(-3776+11024 n-7689 n^2+2397 n^3-384 n^4+31 n^5-n^6) a[-6+n]+(7394-18064 n+12353 n^2-3937 n^3+661 n^4-57 n^5+2 n^6) a[-5+n]+(1452-10548 n+8254 n^2-2655 n^3+423 n^4-33 n^5+n^6) a[-4+n]+(-11046+26716 n-18588 n^2+6013 n^3-1015 n^4+87 n^5-3 n^6) a[-3+n]+(632+5546 n-3888 n^2+1007 n^3-116 n^4+5 n^5) a[-2+n]+(3966-4666 n+3655 n^2-1445 n^3+284 n^4-27 n^5+n^6) a[-1+n]+(2444-3214 n+1409 n^2-283 n^3+27 n^4-n^5) a[n]==0,a[8]==1265,a[9]==12072,a[3]==0,a[4]==1,a[5]==2,a[6]==20,a[7]==144},a,{n,3,20}]}] (* Vaclav Kotesovec, Aug 10 2013 *)

Formula

a(n) = Sum_{m=0..n} (-1)^m*(n-m)!*A061702(n, m), n>2.
From Vladimir Shevelev, Apr 17 2011: (Start)
Let f(n) = F(n-1) + F(n+1) + 2, where F(n) is the n-th Fibonacci number.
Then, for n>=7, we have the recursion:
a(n) = (-1)^n*(4*n+f(n)) + (n/(n-1))*((n+1)*a(n-1) + 2*(-1)^n*f(n-1)) - ((2*n)/(n-2))*((n-3)*a(n-2) + (-1)^n*f(n-2)) + (n/(n-3))*((n-5)*a(n-3) + 2*(-1)^(n-1)*f(n-3)) + (n/(n-4))*(a(n-4) + (-1)^(n-1)*f(n-4)).
This formula (in an equivalent form) is due to K. Yamamoto. (End)
a(n) ~ n!*exp(-3). - Vaclav Kotesovec, Aug 10 2013

Extensions

More terms from Vladeta Jovovic, Jun 18 2001

A004307 Number of permutations p of [n] such that (n-p(i)+i) mod n >= 4 for all i.

Original entry on oeis.org

0, 1, 2, 31, 264, 2783, 30818, 369321, 4745952, 65275999, 957874226, 14951584189, 247524019720, 4334022049377, 80052395326514, 1555999253409203, 31755107852542144, 679008663143893773, 15182701602959054546, 354364531995856105099, 8618865446674052425224
Offset: 4

Views

Author

Keywords

Comments

Old name was: Hit polynomials.

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

A diagonal of A008305.

Programs

  • Mathematica
    (* Very slow *) b[n_, n0_] := Permanent[Table[If[(0 <= j-i && j-i < n-n0) || j-i < -n0, 1, 0], {i, 1, n}, {j, 1, n}]];
    a[n_] := b[n, 4];
    Table[an = a[n]; Print["a(", n, ") = ", an]; an, {n, 4, 24}] (* Jean-François Alcover, Oct 08 2017 *)

Formula

a(n) ~ exp(-4) * n!. - Vaclav Kotesovec, Sep 13 2014

Extensions

More terms from Vladeta Jovovic, Oct 02 2003
Name changed by Andrew Howroyd, Sep 19 2017

A184965 Number of permutations p of [n] such that (n-p(i)+i) mod n >= 6 for all i.

Original entry on oeis.org

1, 0, 0, 0, 0, 0, 0, 1, 2, 78, 888, 13909, 204448, 3182225, 51504968, 873224962, 15498424578, 287972983669, 5598118158336, 113756109812283, 2413723031593090, 53416658591208438, 1231458960862452472, 29538634475147637783, 736321207493996695072
Offset: 0

Views

Author

Alois P. Heinz, Apr 20 2011

Keywords

Examples

			a(8) = 2: (2,3,4,5,6,7,8,1), (3,4,5,6,7,8,1,2).
		

Crossrefs

A diagonal of A008305.

Programs

  • Maple
    with(LinearAlgebra):
    a:= n-> `if`(n=0, 1, Permanent(Matrix(n, (i, j)->
                         `if`(i-j<=0 and i-j>-6 or i-j>n-6, 0, 1)))):
    seq(a(n), n=0..15);
  • Mathematica
    a[n_] := Permanent[Table[If[i-j <= 0 && i-j > -6 || i-j > n-6, 0, 1], {i, 1, n}, {j, 1, n}]]; a[0] = 1; Table[an = a[n]; Print["a(", n, ") = ", an]; an, {n, 0, 15}] (* Jean-François Alcover, Jan 07 2016, adapted from Maple *)

A000804 Permanent of a certain cyclic n X n (0,1) matrix.

Original entry on oeis.org

1, 1, 2, 6, 24, 120, 265, 579, 1265, 2783, 6208, 13909, 31337, 70985, 161545, 369024, 845825, 1944295, 4480285, 10345391, 23930320, 55435605, 128577253, 298529333, 693718721, 1613210120, 3753680073, 8738534315, 20351593033, 47413960239, 110493496000
Offset: 0

Views

Author

Keywords

Comments

a(n) is the number of permutations of [ n ] allowing i->i+j (mod n), j=0..4.

References

  • 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

Cf. A000805.
Fifth column of triangle A008305. - Vladeta Jovovic, Oct 03 2003
Cf. A260074. - Alois P. Heinz, Jul 14 2015

Programs

  • Maple
    a:= n-> `if`(n<5, n!, (Matrix(11, (i,j)-> if i+1=j then 1 elif i=11 then [-1, -1, 2, 2, 4, 2, -6, -2, -2, 0, 3][j] else 0 fi)^(n+6). <<41, -16, 33, -1, 5, -1, 16, 5, 13, 29, 65>>)[1,1]): seq(a(n), n=0..30);
  • Mathematica
    a[n_] := If[n<5, n!, ((Table[Which[i+1 == j, 1, i == 11, {-1, -1, 2, 2, 4, 2, -6, -2, -2, 0, 3}[[j]], True, 0], {i, 1, 11}, {j, 1, 11}] // MatrixPower[#, n+6]&).{41, -16, 33, -1, 5, -1, 16, 5, 13, 29, 65}) // First]; Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Mar 17 2014, after Alois P. Heinz *)

Formula

G.f.: (41*x^15 +64*x^14 -48*x^13 -113*x^12 -213*x^11 -190*x^10 +122*x^9 +158*x^8 +150*x^7 +75*x^6 -60*x^5 -10*x^4 -2*x^3 +x^2 +2*x -1) / (-x^11 -x^10 +2*x^9 +2*x^8 +4*x^7 +2*x^6 -6*x^5 -2*x^4 -2*x^3 +3*x -1).

Extensions

More terms from Vladeta Jovovic, Oct 03 2003
Edited by Alois P. Heinz, Dec 18 2010

A189389 Number of permutations p of [n] such that (n-p(i)+i) mod n >= 5 for all i.

Original entry on oeis.org

1, 0, 0, 0, 0, 0, 1, 2, 49, 484, 6208, 79118, 1081313, 15610304, 238518181, 3850864416, 65598500129, 1177003136892, 22203823852849, 439598257630414, 9117748844458320, 197776095898147080, 4479171132922158213, 105749311074795459594, 2598770324359627927649
Offset: 0

Views

Author

Alois P. Heinz, Apr 20 2011

Keywords

Examples

			a(7) = 2: (2,3,4,5,6,7,1), (3,4,5,6,7,1,2).
		

Crossrefs

A diagonal of A008305.

Programs

  • Maple
    with(LinearAlgebra):
    a:= n-> `if`(n=0, 1, Permanent(Matrix(n, (i, j)->
                         `if`(i-j<=0 and i-j>-5 or i-j>n-5, 0, 1)))):
    seq(a(n), n=0..15);
  • Mathematica
    a[n_] := Permanent[Table[If[i-j <= 0 && i-j > -5 || i-j > n-5, 0, 1], {i, 1, n}, {j, 1, n}]]; a[0] = 1; Table[a[n], {n, 0, 15}] (* Jean-François Alcover, Jan 07 2016, adapted from Maple *)

A306714 Permanent of the circulant matrix whose first row is given by the binary expansion of n.

Original entry on oeis.org

0, 1, 1, 2, 1, 2, 2, 6, 1, 2, 4, 9, 2, 9, 9, 24, 1, 2, 2, 13, 2, 13, 13, 44, 2, 13, 13, 44, 13, 44, 44, 120, 1, 2, 4, 20, 8, 17, 17, 80, 4, 17, 36, 82, 17, 80, 82, 265, 2, 20, 17, 80, 17, 82, 80, 265, 20, 80, 82, 265, 80, 265, 265, 720, 1, 2, 2, 31, 2, 24, 24
Offset: 0

Views

Author

Alois P. Heinz, Mar 05 2019

Keywords

Examples

			The circulant matrix for n = 23 = 10111_2 is
  [1 0 1 1 1]
  [1 1 0 1 1]
  [1 1 1 0 1]
  [1 1 1 1 0]
  [0 1 1 1 1] and has permanent 44, thus a(23) = 44.
a(10) = 4 != a(12) = 2 although 10 = 1010_2 and 12 = 1100_2 have the same number of 0's and 1's.
		

Crossrefs

Programs

  • Maple
    a:= n-> (l-> LinearAlgebra[Permanent](Matrix(nops(l),
             shape=Circulant[l])))(convert(n, base, 2)):
    seq(a(n), n=0..100);

Formula

a(n) = 1 <=> n in { A000079 }.
a(n) = floor(log_2(2n))! for n in { A126646 }.
a(A000225(n)) = A000142(n) for n >= 1.
a(A000051(n)) = A040000(n).
a(A007283(n)) = A007395(n+1).

A000805 Permanent of a certain cyclic n X n (0,1) matrix.

Original entry on oeis.org

1, 1, 2, 6, 24, 120, 720, 1854, 4738, 12072, 30818, 79118, 204448, 528950, 1370674, 3557408, 9244418, 24043990, 62573616, 162925614, 424377730, 1105703640, 2881483458, 7510389278, 19577689120, 51038756326, 133066443346, 346944079632, 904622495746, 2358783572710, 6150613767440, 16038217209886
Offset: 0

Views

Author

Keywords

Comments

Sixth column of triangle A008305. - Vladeta Jovovic, Oct 03 2003

References

  • Henryk Minc and Marvin Marcus, Permanents, Cambridge University Press, 1984, pp. 47-48.
  • 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

Cf. A000804. A column of A008305.

Formula

a(n) = 96+sum(b(i)*a(n-i),i=1..15) where b(i)=[2, 2, 1, 0, -4, -18, -16, -12, -10, -4, 4, 3, 2, 2, 1] for n>=21. - Sean A. Irvine, Jun 29 2011

Extensions

More terms from Vladeta Jovovic, Oct 03 2003
More terms from Sean A. Irvine, Jun 28 2011
Missing term a(5) = 120 inserted by Pontus von Brömssen, Sep 07 2022
Showing 1-10 of 16 results. Next