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
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.
- 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.
- Seiichi Manyama, Table of n, a(n) for n = 0..450 (terms 0..100 from T. D. Noe)
- M. A. Alekseyev, Weighted de Bruijn Graphs for the Menage Problem and Its Generalizations. Lecture Notes in Computer Science 9843 (2016), 151-162. doi:10.1007/978-3-319-44543-4_12 arXiv:1510.07926, [math.CO], 2015-2016.
- Vladimir Baltic, On the number of certain types of strongly restricted permutations, Applicable Analysis and Discrete Mathematics Vol. 4, No 1 (April, 2010), 119-135.
- Kenneth P. Bogart and Peter G. Doyle, Nonsexist solution of the ménage problem, Amer. Math. Monthly 93 (1986), no. 7, 514-519.
- A. Cayley, On a problem of arrangements, Proceedings of the Royal Society of Edinburgh 9 (1878) 338-342.
- A. Cayley, On a problem of arrangements, Proceedings of the Royal Society of Edinburgh 9 (1878) 338-342.
- A. Cayley, On Mr Muir's discussion of Professor Tait's problem of arrangements, Proceedings of the Royal Society of Edinburgh 9 (1878) 388-391.
- A. Cayley, On Mr Muir's discussion of Professor Tait's problem of arrangements, Proceedings of the Royal Society of Edinburgh 9 (1878) 388-391.
- J. Dutka, On the Probleme des Menages, Mathem. Conversat. (2001) 277-287, reprinted from Math. Intell. 8 (1986) 18-25
- A. de Gennaro, How many latin rectangles are there?, arXiv:0711.0527 [math.CO] (2007), see p. 2.
- P. Flajolet and R. Sedgewick, Analytic Combinatorics, 2009; see page 372
- Nick Hobson, Python program for this sequence.
- Peter Kagey, Ranking and Unranking Restricted Permutations, arXiv:2210.17021 [math.CO], 2022.
- Irving Kaplansky, Solution of the "Problème des ménages", Bull. Amer. Math. Soc. 49, (1943). 784-785.
- Irving Kaplansky, Symbolic solution of certain problems in permutations, Bull. Amer. Math. Soc., 50 (1944), 906-914.
- I. Kaplansky and J. Riordan, The problème des ménages, Scripta Math. 12, (1946), 113-124. [Scan of annotated copy]
- S. M. Kerawala, Asymptotic solution of the "Probleme des menages, Bull. Calcutta Math. Soc., 39 (1947), 82-84. [Annotated scanned copy]
- Vaclav Kotesovec, Non-attacking chess pieces, 6ed, 2013, p. 221.
- D. E. Knuth, Comments on A000179, Nov 25 2018 - Nov 27 2018.
- D. E. Knuth, Donald Knuth's 24th Annual Christmas Lecture: Dancing Links, Stanfordonline, Video published on YouTube, Dec 12, 2018.
- A. R. Kräuter, Über die Permanente gewisser zirkulärer Matrizen..., Séminaire Lotharingien de Combinatoire, B11b (1984), 11 pp.
- Yiting Li, Ménage Numbers and Ménage Permutations, J. Int. Seq. 18 (2015) 15.6.8
- E. Lucas, Théorie des Nombres, Gauthier-Villars, Paris, 1891, Vol. 1, p. 495.
- T. Muir, On Professor Tait's problem of arrangement, Proceedings of the Royal Society of Edinburgh 9 (1878) 382-387.
- T. Muir, On Professor Tait's problem of arrangement, Proceedings of the Royal Society of Edinburgh 9 (1878) 382-387.
- Vladimir Shevelev and Peter J. C. Moses, The ménage problem with a known mathematician, arXiv:1101.5321 [math.CO], 2011, 2015.
- Vladimir Shevelev and Peter J. C. Moses, Alice and Bob go to dinner: A variation on menage, INTEGERS, Vol. 16 (2016), #A72.
- R. J. Stones, S. Lin, X. Liu and G. Wang, On Computing the Number of Latin Rectangles, Graphs and Combinatorics (2016) 32:1187-1202; DOI 10.1007/s00373-015-1643-1.
- H. M. Taylor, A problem on arrangements, Mess. Math., 32 (1902), 60ff. [Annotated scanned copy]
- J. Touchard, Théorie des substitutions. Sur un problème de permutations, C. R. Acad. Sci. Paris 198 (1934), 631-633.
- Eric Weisstein's World of Mathematics, Married Couples Problem.
- Eric Weisstein's World of Mathematics, Rooks Problem.
- Wikipedia, Menage problem.
- M. Wyman and L. Moser, On the problème des ménages, Canad. J. Math., 10 (1958), 468-480.
- D. Zeilberger, Automatic Enumeration of Generalized Menage Numbers, arXiv preprint arXiv:1401.1089 [math.CO], 2014.
Cf.
A000904,
A059375,
A102761,
A000186,
A094047,
A067998,
A033999,
A258664,
A258665,
A258666,
A258667,
A258673,
A259212,
A213234,
A000023.
-
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
-
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
-
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 *)
-
\\ 3 programs adapted to a(1) = -1 by Hugo Pfoertner, Aug 31 2020
-
{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 */
-
a(n)=if(n>1, round(2*n*exp(-2)*besselk(n, 2)), 1-2*n) \\ Charles R Greathouse IV, Nov 03 2014
-
{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 */
-
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
A258664
A total of n married couples, including a mathematician M and his wife, are to be seated at the 2n chairs around a circular table, with no man seated next to his wife. After the ladies are seated at every other chair, M is the first man allowed to choose one of the remaining chairs. The sequence gives the number of ways of seating the other men, with no man seated next to his wife, if M chooses the chair that is 3 seats clockwise from his wife's chair.
Original entry on oeis.org
0, 0, 1, 1, 4, 20, 115, 787, 6184, 54888, 542805, 5916725, 70463900, 910167596, 12672415015, 189181881575, 3014307220880, 51054940726928, 915987174021609, 17352888926841897, 346144782915314740, 7251738265074465220, 159193007549552845339, 3654204694819144118651
Offset: 1
- I. Kaplansky and J. Riordan, The problème des ménages, Scripta Math. 12, (1946), 113-124.
- J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, chs. 7, 8.
- Peter J. C. Moses, Seatings for 6 couples
- I. Kaplansky and J. Riordan, The problème des ménages, Scripta Math. 12, (1946), 113-124. [Scan of annotated copy]
- E. Lucas, Sur le problème des ménages, Théorie des nombres, Paris, 1891, 491-496.
- Vladimir Shevelev, Peter J. C. Moses, The ménage problem with a known mathematician, arXiv:1101.5321 [math.CO], 2011, 2015.
- Vladimir Shevelev and Peter J. C. Moses, Alice and Bob go to dinner: A variation on menage, INTEGERS, Vol. 16 (2016), #A72.
- J. Touchard, Sur un problème de permutations, C.R. Acad. Sci. Paris, 198 (1934), 631-633.
-
a[d_,n_]:=If[n<=#-1,0,Sum[((-1)^k)*(n-k-1)!Sum[Binomial[2#-j-4,j]*Binomial[2(n-#)-k+j+2,k-j],{j,Max[#+k-n-1,0],Min[k,#-2]}],{k,0,n-1}]]&[(d+3)/2];
Map[a[3,#]&,Range[25]] (* Peter J. C. Moses, Jun 07 2015 *)
-
a(n) = sum(k=0, n-1, (-1)^k*(n-k-1)!*sum(j=max(k-n+2, 0), min(k,1), binomial(2-j, j)*binomial(2*n-k+j-4, k-j))); \\ Michel Marcus, Jun 26 2015
A258665
A total of n married couples, including a mathematician M and his wife, are to be seated at the 2n chairs around a circular table, with no man seated next to his wife. After the ladies are seated at every other chair, M is the first man allowed to choose one of the remaining chairs. The sequence gives the number of ways of seating the other men, with no man seated next to his wife, if M chooses the chair that is 5 seats clockwise from his wife's chair.
Original entry on oeis.org
0, 0, 0, 1, 5, 20, 116, 791, 6203, 55000, 543576, 5922813, 70518113, 910704988, 12678282940, 189251856883, 3015212009143, 51067548545968, 916175515710896, 17355891466436025, 346195661281979133, 7252651426282955236, 159210312386078554436, 3654549974493252076175
Offset: 1
- I. Kaplansky and J. Riordan, The problème des ménages, Scripta Math. 12, (1946), 113-124.
- J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, chs. 7, 8.
- Peter J. C. Moses, Seatings for 6 couples.
- I. Kaplansky and J. Riordan, The problème des ménages, Scripta Math. 12, (1946), 113-124. [Scan of annotated copy]
- E. Lucas, Sur le problème des ménages, Théorie des nombres, Paris, 1891, 491-496.
- Vladimir Shevelev, Peter J. C. Moses, The ménage problem with a known mathematician, arXiv:1101.5321 [math.CO], 2011, 2015.
- Vladimir Shevelev and Peter J. C. Moses, Alice and Bob go to dinner: A variation on menage, INTEGERS, Vol. 16(2016), #A72.
- J. Touchard, Sur un problème de permutations, C.R. Acad. Sci. Paris, 198 (1934), 631-633.
-
enumerateSeatings[pairs_,d_]:=If[d==1||d>=2pairs-1||EvenQ[d],{},
Map[#[[1]]&,DeleteCases[Map[{#,Differences[#]}&[Riffle[Range[pairs],#]]&,Map[Insert[#,1,(d+1)/2]&,Permutations[#,{Length[#]}]&[Rest[Range[pairs]]]]],{{_},{_,0,_}}]]];
enumerateSeatings[6,5]
a[pairs_,d_]:=If[pairs<=#-1||EvenQ[d]||d==1,0,Sum[((-1)^k)*(pairs-k-1)!Sum[Binomial[2#-j-4,j]*Binomial[2(pairs-#)-k+j+2,k-j],{j,Max[#+k-pairs-1,0],Min[k,#-2]}],{k,0,pairs-1}]]&[(d+3)/2];
Table[a[n,5],{n,15}] (* Peter J. C. Moses, Jun 13 2015 *)
-
a(n) = sum(k=0,n-1, (-1)^k*(n-k-1)! * sum(j=max(k-n+3, 0), min(k,2), binomial(4-j, j)*binomial(2*n-k+j-6, k-j))); \\ Michel Marcus, Jun 13 2015
A258667
A total of n married couples, including a mathematician M and his wife, are to be seated at the 2n chairs around a circular table, with no man seated next to his wife. After the ladies are seated at every other chair, M is the first man allowed to choose one of the remaining chairs. The sequence gives the number of ways of seating the other men, with no man seated next to his wife, if M chooses the chair that is 9 seats clockwise from his wife's chair.
Original entry on oeis.org
0, 0, 0, 0, 0, 20, 116, 791, 6205, 55004, 543596, 5922929, 70518903, 910711188, 12678337924, 189252400363, 3015217931281, 51067619058668, 916176426367084, 17355904144230373, 346195850528456683, 7252654441430368404, 159210363452786908116, 3654550890657000160319
Offset: 1
- I. Kaplansky and J. Riordan, The problème des ménages, Scripta Math. 12, (1946), 113-124.
- J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, chs. 7, 8.
- I. Kaplansky and J. Riordan, The problème des ménages, Scripta Math. 12, (1946), 113-124. [Scan of annotated copy]
- Peter J. C. Moses, Seatings for 6 couples
- E. Lucas, Sur le problème des ménages, Théorie des nombres, Paris, 1891, 491-496.
- Vladimir Shevelev, Peter J. C. Moses, The ménage problem with a known mathematician, arXiv:1101.5321 [math.CO], 2011-2015.
- Vladimir Shevelev and Peter J. C. Moses, Alice and Bob go to dinner: A variation on menage, INTEGERS, Vol. 16(2016), #A72.
- J. Touchard, Sur un problème de permutations, C.R. Acad. Sci. Paris, 198 (1934), 631-633.
-
a[n_] := If[n<6, 0, Sum[(-1)^k (n-k-1)! Sum[Binomial[8-j, j] Binomial[2n-k+j-10, k-j], {j, Max[k-n+5, 0], Min[k, 4]}], {k, 0, n-1}]];
Array[a, 24] (* Jean-François Alcover, Sep 19 2018 *)
-
a(n) = if (n<=5, 0, sum(k=0, n-1, (-1)^k*(n-k-1)!*sum(j=max(k-n+5, 0), min(k,4), binomial(8-j, j)*binomial(2*n-k+j-10, k-j)))); \\ Michel Marcus, Jun 26 2015
A059375
Number of seating arrangements for the ménage problem.
Original entry on oeis.org
1, 0, 0, 12, 96, 3120, 115200, 5836320, 382072320, 31488549120, 3191834419200, 390445460697600, 56729732529254400, 9659308746908620800, 1905270127543015833600, 431026303509734220288000, 110865322076320374571008000, 32172949121885378686623744000
Offset: 0
a(3) = 12 because there is a unique seating arrangement up to circular and clockwise / counterclockwise symmetry. - _Paul C. Kainen_ and _Michael Somos_, Mar 11 2011
- L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 184, mu*(n).
- H. J. Ryser, Combinatorial Mathematics. Mathematical Association of America, Carus Mathematical Monograph 14, 1963, p. 32. equation (2.3).
- Seiichi Manyama, Table of n, a(n) for n = 0..253
- M. A. Alekseyev, Weighted de Bruijn Graphs for the Menage Problem and Its Generalizations. Lecture Notes in Computer Science 9843 (2016), 151-162. doi:10.1007/978-3-319-44543-4_12 arXiv:1510.07926
- V. Baltic, On the number of certain types of strongly restricted permutations, Appl. An. Disc. Math. 4 (2010), 119-135. doi:10.2298/AADM1000008B
- K. P. Bogart and P. G. Doyle, Nonsexist solution of the menage problem, Amer. Math. Monthly 93:7 (1986), 514-519.
- A. Guterman, Pólya permanent problem: 100 years after, 2014.
- Vladimir Shevelev, Peter J. C. Moses, The ménage problem with a known mathematician, arXiv:1101.5321 [math.CO], 2011, 2015.
- Wikipedia, Menage Problem
-
a[0] = 1; a[1] = 0; a[n_] := 4n n! Sum[(-1)^k Binomial[2n-k, k] (n-k)! / (2n-k), {k, 0, n}]; Table[a[n], {n, 0, 17}] (* Jean-François Alcover, Jun 19 2017, from 1st formula *)
-
{a(n) = local(A); if( n<3, n==0, A = vector(n); A[3] = 1; for(k=4, n, A[k] = (k * (k - 2) * A[k-1] + k * A[k-2] - 4 * (-1)^k) / (k-2)); 2 * n! * A[n])} /* Michael Somos, Mar 11 2011 */
A258673
A total of n married couples, including a mathematician M and his wife, are to be seated at the 2n chairs around a circular table, with no man seated next to his wife. After the ladies are seated at every other chair, M is the first man allowed to choose one of the remaining chairs. The sequence gives the number of ways of seating the other men, with no man seated next to his wife, if M chooses the chair that is 11 seats clockwise from his wife's chair.
Original entry on oeis.org
0, 0, 0, 0, 0, 0, 115, 791, 6204, 55004, 543597, 5922929, 70518904, 910711192, 12678337943, 189252400475, 3015217932052, 51067619064756, 916176426421297, 17355904144767765, 346195850534324608, 7252654441500343712, 159210363453691696379, 3654550890669607979359
Offset: 1
- I. Kaplansky and J. Riordan, The problème des ménages, Scripta Math. 12, (1946), 113-124.
- J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, chs. 7, 8.
- I. Kaplansky and J. Riordan, The problème des ménages, Scripta Math. 12, (1946), 113-124. [Scan of annotated copy]
- Peter J. C. Moses, Seatings for 7 couples.
- E. Lucas, Sur le problème des ménages, Théorie des nombres, Paris, 1891, 491-496.
- Vladimir Shevelev, Peter J. C. Moses, The ménage problem with a known mathematician, arXiv:1101.5321 [math.CO], 2011, 2015.
- Vladimir Shevelev and Peter J. C. Moses, Alice and Bob go to dinner: A variation on menage, INTEGERS, Vol. 16(2016), #A72.
- J. Touchard, Sur un problème de permutations, C.R. Acad. Sci. Paris, 198 (1934), 631-633.
-
a[d_,n_]:=If[n<=#-1,0,Sum[((-1)^k)*(n-k-1)!Sum[Binomial[2#-j-4,j]*Binomial[2(n-#)-k+j+2,k-j],{j,Max[#+k-n-1,0],Min[k,#-2]}],{k,0,n-1}]]&[(d+3)/2];
Map[a[11,#]&,Range[20]] (* Peter J. C. Moses, Jun 07 2015 *)
A259212
A total of n married couples, including a mathematician M and his wife W, are to be seated at the 2n chairs around a circular table. M and W are the first couple allowed to choose chairs, and they choose two chairs next to each other. The sequence gives the number of ways of seating the remaining couples so that women and men are in alternate chairs but M and W are the only couple seated next to each other.
Original entry on oeis.org
0, 0, 0, 6, 72, 1920, 69120, 3402000, 218252160, 17708544000, 1773002649600, 214725759494400, 30941575378560000, 5231894853375590400, 1025881591718766182400, 230901375630648602880000, 59127083048250564931584000, 17091634972762948947148800000
Offset: 1
-
a[n_] := (n-1)! Sum[(-1)^(n-k+1) k! Binomial[n+k-1, 2k], {k, 0, n}]; a[1] = 0; Array[a, 18] (* Jean-François Alcover, Sep 03 2016 *)
Join[{0}, Table[-(-1)^n (n - 1)! HypergeometricPFQ[{1, 1 - n, n}, {1/2}, 1/4], {n, 2, 20}]] (* Eric W. Weisstein, Mar 27 2018 *)
-
a(n) = if (n==1, 0, my(m=n-1); m!*sum(k=0, m, binomial(2*m-k,k)*(m-k)!*(-1)^k)); \\ Michel Marcus, Jun 26 2015
A332709
Triangle T(n,k) read by rows where T(n,k) is the number of ménage permutations that map 1 to k, with 3 <= k <= n.
Original entry on oeis.org
1, 1, 1, 4, 5, 4, 20, 20, 20, 20, 115, 116, 117, 116, 115, 787, 791, 791, 791, 791, 787, 6184, 6203, 6204, 6205, 6204, 6203, 6184, 54888, 55000, 55004, 55004, 55004, 55004, 55000, 54888, 542805, 543576, 543595, 543596, 543597, 543596, 543595, 543576, 542805
Offset: 3
Triangle begins:
n\k| 3 4 5 6 7 8 9 10
---+--------------------------------------------------------
3 | 1
4 | 1, 1
5 | 4, 5, 4
6 | 20, 20, 20, 20
7 | 115, 116, 117, 116, 115
8 | 787, 791, 791, 791, 791, 787
9 | 6184, 6203, 6204, 6205, 6204, 6203, 6184
10 | 54888, 55000, 55004, 55004, 55004, 55004, 55000, 54888
For n=5 and k=3, the T(5,3)=4 permutations on five letters that start with a 3 are 31524, 34512, 35124, and 35212.
-
T[n_, k_] :=
Sum[Sum[(-1)^i*(n - i - 1)!*Binomial[2*k - j - 4, j]*
Binomial[2*(n - k + 1) - i + j, i - j], {j, Max[k + i - n - 1, 0],
Min[i, k - 2]}], {i, 0, n - 1}]
(* Peter Kagey, Jan 22 2021 *)
Showing 1-8 of 8 results.
Comments