login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A000316 Two decks each have n kinds of cards, 2 of each kind. The first deck is laid out in order. The second deck is shuffled and laid out next to the first. A match occurs if a card from the second deck is next to a card of the same kind from the first deck. a(n) is the number of ways of achieving no matches.
(Formerly M3702 N1513)
9

%I M3702 N1513 #90 Mar 26 2023 10:27:45

%S 1,0,4,80,4752,440192,59245120,10930514688,2649865335040,

%T 817154768973824,312426715251262464,145060238642780180480,

%U 80403174342119992692736,52443098500204184915312640,39764049487996490505336537088

%N Two decks each have n kinds of cards, 2 of each kind. The first deck is laid out in order. The second deck is shuffled and laid out next to the first. A match occurs if a card from the second deck is next to a card of the same kind from the first deck. a(n) is the number of ways of achieving no matches.

%C Each deck contains 2n cards.

%C The probability of no matches is a(n)/(2n)!.

%C n couples meet for a party and they exchange gifts. Each of the 2n writes their name on a piece of paper and puts it into a hat. They take turns drawing names and give their gift to the person whose name they drew. If anyone draws either their own name or the name of their partner, everyone puts the name they have drawn back into the hat and everyone draws anew. a(n) is the number of different permissible drawings. - _Dan Dima_, Dec 17 2006

%C (2n)! / a(n) is the expected number of deck shuffles until no matches occur. a(n) / (2n)! is the probability for a permissible drawing to be achieved. (2n)! / a(n) is the expected number of drawings before a permissible drawing is achieved. As n goes to infinity (2n)! / a(n) will strictly decrease very slowly to e^2 ~ 7.38906 (starting from n > 2) - _Dan Dima_, Dec 17 2006

%C a(n) equals the permanent of the (2n)X(2n) matrix with 0's along the main diagonal and the antidiagonal, and 1's everywhere else. - _John M. Campbell_, Jul 11 2011

%C Also, number of permutations p of (1,...,2n) such that round(p(k)/2) != round(k/2) for all k=1,...,2n (where half-integers are rounded up). - _M. F. Hasler_, Sep 30 2015

%D F. N. David and D. E. Barton, Combinatorial Chance, Hafner, NY, 1962, Ch. 7 and Ch. 12.

%D J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p. 187.

%D N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).

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

%H T. D. Noe, <a href="/A000316/b000316.txt">Table of n, a(n) for n = 0..100</a>

%H F. F. Knudsen and I. Skau, <a href="http://www.jstor.org/stable/2691467">On the Asymptotic Solution of a Card-Matching Problem</a>, Mathematics Magazine 69 (1996), 190-197.

%H B. H. Margolius, <a href="http://www.jstor.org/stable/3219303">The Dinner-Diner Matching Problem</a>, Mathematics Magazine, 76 (2003), 107-118.

%H Barbara H. Margolius, <a href="http://academic.csuohio.edu/bmargolius/homepage/dinner/dinner/cardentry.htm">Dinner-Diner Matching Probabilities</a>

%H L. I. Nicolaescu, <a href="http://nyjm.albany.edu/j/2004/10-7.pdf">Derangements and asymptotics of the Laplace transforms of large powers of a polynomial</a>, New York J. Math. 10 (2004) 117-131.

%H John Riordan and N. J. A. Sloane, <a href="/A003471/a003471_1.pdf">Correspondence, 1974</a>

%H E. I. Vatutin, A. D. Belyshev, N. N. Nikitina, and M. O. Manzuk, <a href="http://evatutin.narod.ru/evatutin_dls_scf_gen.pdf">Use of X-based diagonal fillings and ESODLS CMS schemes for enumeration of main classes of diagonal Latin squares</a>, Telecommunications, 2023, No. 1, pp. 2-16, DOI: 10.31044/1684-2588-2023-0-1-2-16 (in Russian).

%H <a href="/index/Ca#cardmatch">Index entries for sequences related to card matching</a>

%F a(n) = A000459(n)*2^n.

%F G.f.: Sum_{j=0..n*k} coeff(R(x, n, k), x, j)*(-1)^j*(n*k-j)! where n is the number of kinds of cards, k is the number of cards of each kind (2 in this case) and R(x, n, k) is the rook polynomial given by R(x, n, k)=(k!^2*Sum_{j=0..k} x^j/((k-j)!^2*j!))^n (see Riordan). coeff(R(x, n, k), x, j) indicates the coefficient for x^j of the rook polynomial.

%F From _Dan Dima_, Dec 17 2006: (Start)

%F a(n) = n! * Sum_{a,b >= 0, a+b <= n} (-1)^b * 2^(a+2*b) * (2*n-2*a-b)! / (a! * b! * (n-a-b)!).

%F a(n) = n * a(n-1) + n! * 4^n * Sum_{a=0..n} (-1)^a / (a! * 2^a). (End)

%F a(n) = 2^n * round(2^(n/2 + 3/4)*Pi^(-1/2)*exp(-2)*n!*BesselK(1/2+n,2^(1/2))) for n > 0. - _Mark van Hoeij_, Oct 30 2011

%F Recurrence: (2*n-3)*a(n) = 2*(n-1)*(2*n-1)^2*a(n-1) + 4*(n-1)*(2*n-3)*a(n-2) - 16*(n-2)*(n-1)*(2*n-1)*a(n-3). - _Vaclav Kotesovec_, Aug 07 2013

%F From _Peter Bala_, Jul 07 2014: (Start)

%F a(n) = Integral_{x>=0} exp(-x)*(x^2 - 4*x + 2)^n dx. Cf. A000166(n) = Integral_{x>=0} exp(-x)*(x - 1)^n dx.

%F Asymptotic: a(n) ~ (2*n)!*exp(-2)*( 1 - 1/(2*n) - 23/(96*n^2) + O(1/n^3) ). See Nicolaescu. (End)

%e There are 80 ways of achieving zero matches when there are 2 cards of each kind and 3 kinds of card so a(3)=80.

%e Among the 24 (multiset) permutations of {1,1',2,2'}, only {2,2',1,1'}, {2',2,1,1'}, {2,2',1',1} and {2',2,1',1} have no fixed points, thus a(2)=4.

%p p := (x,k)->k!^2*sum(x^j/((k-j)!^2*j!),j=0..k); R := (x,n,k)->p(x,k)^n; f := (t,n,k)->sum(coeff(R(x,n,k),x,j)*(t-1)^j*(n*k-j)!,j=0..n*k); seq(f(0,n,2), n=0..18);

%t (* b = A000459 *)

%t b[n_] := b[n] = Switch[n, 0, 1, 1, 0, 2, 1, _, n(2n-1) b[n-1] + 2n(n-1) b[n-2] - (2n-1)];

%t a[n_] := b[n] * 2^n;

%t Array[a, 14] (* _Jean-François Alcover_, Oct 30 2019 *)

%o (PARI) a(n)=if(n==0, 1, round(2^(n/2+3/4)/Pi^.5*exp(-2)*n!*besselk(1/2+n,2^.5))<<n) \\ requires sufficient realprecision. - _M. F. Hasler_, Sep 27 2015

%o (PARI) \\ Illustration of the multiset-fixed-point interpretation

%o count(n,c=ceil(vector(n,i,i)/2))=sum(k=1,n!,!setsearch(Set(ceil(Vec(numtoperm(n,k))/2)-c),0))

%o a(n) = count(2*n) \\ _M. F. Hasler_, Sep 30 2015

%Y Cf. A000166, A000459, A337302.

%K nonn,easy,nice

%O 0,3

%A _N. J. A. Sloane_

%E Formulae, more terms etc. from Barbara Haas Margolius (margolius(AT)math.csuohio.edu), Dec 22 2000

%E Edited by _M. F. Hasler_, Sep 27 2015 and _N. J. A. Sloane_, Oct 02 2015

%E a(0)=1 prepended by _Andrew Howroyd_, Oct 09 2020

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 16:42 EDT 2024. Contains 371989 sequences. (Running on oeis4.)