%I #16 Sep 26 2017 05:08:45
%S 1,0,0,0,0,24,576,0,9216,0,20736,0,9216,0,576,4783104,25214976,
%T 62705664,98648064,109859328,87588864,54411264,23887872,9455616,
%U 1769472,663552,0,13824,248341303296,1215287525376,2855842873344
%N Card-matching numbers (Dinner-Diner matching numbers).
%C This is a triangle of card matching numbers. Two decks each have n kinds of cards, 4 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. Triangle T(n,k) is the number of ways of achieving exactly k matches (k=0..4n). The probability of exactly k matches is T(n,k)/(4n)!.
%C rows are of length 1,5,9,13,...
%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, pp. 174-178.
%D R. P. Stanley, Enumerative Combinatorics Volume I, Cambridge University Press, 1997, p. 71.
%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 Barbara H. Margolius, <a href="http://academic.csuohio.edu/bmargolius/homepage/dinner/dinner/cardentry.htm">Dinner-Diner Matching Probabilities</a>
%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 S. G. Penrice, <a href="http://www.jstor.org/stable/2324927">Derangements, permanents and Christmas presents</a>, The American Mathematical Monthly 98(1991), 617-620.
%H <a href="/index/Ca#cardmatch">Index entries for sequences related to card matching</a>
%F G.f.: sum(coeff(R(x, n, k), x, j)*(t-1)^j*(n*k-j)!, j=0..n*k) where n is the number of kinds of cards, k is the number of cards of each kind (here k is 4) and R(x, n, k) is the rook polynomial given by R(x, n, k)=(k!^2*sum(x^j/((k-j)!^2*j!))^n (see Stanley or Riordan). coeff(R(x, n, k), x, j) indicates the j-th coefficient on x of the rook polynomial.
%e There are 9216 ways of matching exactly 2 cards when there are 2 different kinds of cards, 4 of each in each of the two decks so T(2,2)=9216.
%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);
%p for n from 0 to 4 do seq(coeff(f(t,n,4),t,m),m=0..4*n); od;
%t 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[ Coefficient[ r[x, n, k], x, j]*(t-1)^j*(n*k-j)!, {j, 0, n*k}]; a[n_, m_] := Coefficient[ f[t, n, 4], t, m]; Table[a[n, m], {n, 0, 4}, {m, 0, 4*n}] // Flatten (* _Jean-François Alcover_, Oct 07 2013, translated from Maple *)
%Y Cf. A008290, A059056-A059071.
%K nonn,tabf,nice
%O 0,6
%A Barbara Haas Margolius (margolius(AT)math.csuohio.edu)