4

I was reading this paper by Ekhad, Koutschan, and Zeilberger titled "There are EXACTLY 1493804444499093354916284290188948031229880469556 Ways to Derange a Standard Deck of Cards (ignoring suits) [and many other such useful facts]", where the authors calculated the number of derangements of a deck of $52$ cards, where cards of the same rank are considered identical. My question is about generalizing this result to partial derangements.

Question: For each $k\in \{0,1,\dots,52\}$, what is the number of permutations of a deck of $52$ cards which have exactly $k$ fixed points, where cards of the same rank are considered identical?

Call this number $D_k$. Would using the Laguerre polynomials that the paper uses suffice to compute $D_k$? I believe that $$D_0 = \int_{0}^{\infty} e^{-x} (L_4(x))^{13} dx = 1493804444499093354916284290188948031229880469556$$ from the paper. For 1 fixed point, we could have $$D_1 = -13\int_{0}^{\infty} e^{-x} (L_4(x))^{12} L_3(x) dx$$ and for more fixed points, we could have something like $$D_k = (-1)^{52-k} \sum_{p\in \text{partitions}(k,4)} \frac{13!}{\left( 13-|p| \right)!} \int_{0}^{\infty} e^{-x} \left( \prod_{p_i\in p}L_{(4-p_i)}(x) \right) L_4(x)^{13-|p|} dx$$

where $\text{partitions}(n, k)$ is the set of partitions of $n$ with parts $\leq k$ and $|p|$ is the number of parts in a particular partition $p$.

Any suggestions are welcome.

RobPratt
  • 45,619
Sherlock9
  • 245
  • 1
    a) A factor $-1$ is missing in $D_1$. b) I think $D_k$ doesn't account for symmetry properly. It seems correct for $k=2$, but e.g. for $k=3$ the partition $2+1$ is undercounted because you only count the unordered pairs of ranks, but the ranks are different because one has $1$ fixed point and one has $2$, so there are twice as many partial derangements as you're counting. – joriki Feb 24 '23 at 15:57
  • 1
    (You can get properly sized parentheses (and other paired delimiters) that adapt to their content by preceding them with \left and \right.) – joriki Feb 24 '23 at 15:58

1 Answers1

1

Your idea does work – but you also need to account for the locations of fixed points within their home ranks. Here is a SymPy program to calculate the $D_k$:

#!/usr/bin/env python3
from sympy import *
from sympy.utilities.iterables import partitions
from sympy.abc import x
s = 4
r = 13

def even_gillis(partition): partition[0] = r - sum(partition.values()) m1 = factorial(r) / prod(factorial(c) for c in partition.values()) # distribution of fixed point counts m2 = prod(binomial(s,p)c for (p,c) in partition.items()) # distribution of fixed points in "home" rank return abs(m1 * m2 * integrate(exp(-x) * prod(laguerre(s-p, x)c for (p,c) in partition.items()), [x, 0, oo]))

def partial_derangements(f): return sum(map(even_gillis, partitions(f, m=r, k=s)))

res = {} for f in range(s*r+1): pd = partial_derangements(f) print(f, pd) res[f] = pd print(sum(res.values()))

And here are the results: $$ \begin{array}{r|l} k&D_k\\ \hline 0&1493804444499093354916284290188948031229880469556\\ 1&6340385757557016669128420681559913588527453996864\\ 2&13266567232207057196014773086716987647277293815856\\ 3&18238668284676205177418898082466616089067625607616\\ 4&18526769548311847223050211825372407524039077015557\\ 5&14826224260233156028288754354346995034911746027008\\ 6&9732708392068246090956225651522314943138294316704\\ 7&5388382133535087467858278212335850455674549925120\\ 8&2567258926131602469308920690973149684353615798276\\ 9&1068839557015030994188955669673671973162569909952\\ 10&393534296458352079879548193177365201106785737968\\ 11&129371970433250016992346298354693416312270368064\\ 12&38271861262950277022473531520430194406090429150\\ 13&10254432892901004797163139073870817866169740416\\ 14&2502028211163453511033632375709022781594997632\\ 15&558489068026035105701769031504044064553874048\\ 16&114492933061917767485607764612228911867407264\\ 17&21629266186692633175386060136767163967218560\\ 18&3776237464936831529921454444732822904439616\\ 19&610822862705574444615834900761255140405632\\ 20&91737539975720228203466396152069450492503\\ 21&12816366440544896999386077594111721526784\\ 22&1668274956079648413449611940576063055040\\ 23&202607555532030287897710870057828970496\\ 24&22984837821463304425124924502086877192\\ 25&2438138734503872483064403804289088896\\ 26&242029379436229196341907014157600736\\ 27&22499164519129073264215408330416768\\ 28&1959697454240653635204549865387284\\ 29&159998642365496645012580155674368\\ 30&12248351055202924758280988299392\\ 31&879338509214420888551480829696\\ 32&59209757027395856005889630580\\ 33&3739338499202164436917045824\\ 34&221481166178568820575299248\\ 35&12301956968645810278717632\\ 36&640693604925620624217411\\ 37&31283060497329005414400\\ 38&1431888035067524589984\\ 39&61438162479298023168\\ 40&2471333583132294452\\ 41&93214815560857536\\ 42&3298149470856240\\ 43&109531765355584\\ 44&3417031057518\\ 45&100213356672\\ 46&2770050816\\ 47&71660160\\ 48&1814904\\ 49&36608\\ 50&1248\\ 51&0\\ 52&1 \end{array}$$ $$\Sigma=92024242230271040357108320801872044844750000000000=\frac{52!}{4!^{13}}$$

Parcly Taxel
  • 103,344