login
Number of ways n married couples can sit in a row without any spouses next to each other.
13

%I #77 Oct 19 2023 07:27:50

%S 1,0,8,240,13824,1263360,168422400,30865121280,7445355724800,

%T 2287168006717440,871804170613555200,403779880746418176000,

%U 223346806774106790297600,145427383048755178635264000,110105698060190464791596236800,95914116314126658718742347776000,95252504853751428295192341381120000

%N Number of ways n married couples can sit in a row without any spouses next to each other.

%C Limit_{n->oo} a(n)/(2n)! = 1/e.

%C Also the number of (directed) Hamiltonian paths of the n-cocktail party graph. - _Eric W. Weisstein_, Dec 16 2013

%C Also the number of ways to label the cells of a 2 X n grid such that no vertically adjacent cells have adjacent labels. - _Sela Fried_, May 29 2023

%H Andrew Woods, <a href="/A007060/b007060.txt">Table of n, a(n) for n = 0..100</a>

%H G. Almkvist, <a href="/A007043/a007043.pdf">Letter to N. J. A. Sloane, Apr. 1992</a>.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/CocktailPartyGraph.html">Cocktail Party Graph</a>.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/HamiltonianPath.html">Hamiltonian Path</a>.

%F a(n) = (Pi*BesselI(n+1/2,1)*(-1)^n+BesselK(n+1/2,1))*exp(-1)*(2/Pi)^(1/2)*2^n*n!. - _Mark van Hoeij_, Nov 12 2009

%F a(n) = (-1)^n*2^n*n!*A000806(n), n>0. - _Vladeta Jovovic_, Nov 19 2009

%F a(n) = n!*hypergeom([-n, n+1],[],1/2)*(-2)^n. - _Mark van Hoeij_, Nov 13 2009

%F a(n) = 2^n * A114938(n). - _Toby Gottfried_, Nov 22 2010

%F a(n) = 2*n((2*n-1)*a(n-1) + (2*n-2)*a(n-2)), n > 1. - _Aaron Meyerowitz_, May 14 2014

%F From _Peter Bala_, Mar 06 2015: (Start)

%F a(n) = Sum_{k = 0..n} (-1)^(n-k)*binomial(n,k)*A000166(2*k).

%F For n >= 1, Integral_{x = 0..1} (x^2 - 1)^n*exp(x) dx = a(n)*e - A177840(n). Hence lim_{n->oo} A177840(n)/a(n) = e. (End)

%F a(n) ~ sqrt(Pi) * 2^(2*n+1) * n^(2*n + 1/2) / exp(2*n+1). - _Vaclav Kotesovec_, Mar 09 2016

%e For n = 2, the a(2) = 8 solutions for the couples {1,2} and {3,4} are {1324, 1423, 2314, 2413, 3142, 3241, 4132, 4231}.

%p seq(add((-1)^i*binomial(n, i)*2^i*(2*n-i)!, i=0..n),n=0..20);

%t Table[Sum[(-1)^i Binomial[n,i] (2 n - i)! 2^i, {i, 0, n}], {n, 0, 20}]

%t Table[(2 n)! Hypergeometric1F1[-n, -2 n, -2], {n, 0, 20}]

%o (PARI) a(n)=sum(k=0, n, binomial(n, k)*(-1)^(n-k)*(n+k)!*2^(n-k)) \\ _Charles R Greathouse IV_, May 11 2016

%o (Python)

%o from sympy import binomial, subfactorial

%o def a(n): return sum([(-1)**(n - k)*binomial(n, k)*subfactorial(2*k) for k in range(n + 1)]) # _Indranil Ghosh_, Apr 28 2017

%Y Cf. A000166, A000806, A114938, A177840, A053983, A053984, A193624, A229430, A330266.

%K nonn,easy,nice

%O 0,3

%A David Roberts Keeney (David.Roberts.Keeney(AT)directory.Reed.edu)

%E More terms from _Michel ten Voorde_, Apr 11 2001