# Derangements with repetitive numbers

Hi to all i have a very simple problem

Lets assume that i have a well shuffled deck of 52 cards.

I start drawing the top card always and when the card matches it's rank i lose. J=11 Q=12 K=13

If there were only 13 cards i could easily use the $\ \frac{!n}{n!}$ for derangements in order to solve this. The problem is that there are 52 cards so when i pass 13 i start from 1 again so i don't know what is the probability to win. Example of the game

1st card: 4 - Continue 2nd Card: A - continue 3rd Card: K - Continue 4th Card: K - Continue 5th Card: 6 - Continue 6th Card: 9 - Continue 7th Card: 10 - Continue 8th Card: A - Continue 9th Card: J - Continue 10th Card: 3 - Continue 11th Card: 2 - Continue 12th Card: 8 - Continue 13th Card: A - Continue 1st card: 5 - Continue 2nd Card 2 LOSE

So actually i have to count from 1 to 13 4 times and if i draw all 52 cards then i win. What's the Probability?

-

The answer is given in this Wikipedia section on generalized derangements. The number of permutations of $52$ cards with $4$ copies each of $13$ ranks that leave none of the ranks in place is

\begin{align} &\int_0^\infty (4!\cdot L_4(x))^{13}\mathrm e^{-x}\,\mathrm dx =\int_0^\infty\left(x^4-16x^3+72x^2-96x+24\right)^{13}\mathrm e^{-x}\,\mathrm dx \\\\\\ =&1309302175551177162931045000259922525308763433362019257020678406144 \end{align}

(computation), where $L_4(x)$ is the fourth Laguerre polynomial. Since there are

$$52!=80658175170943878571660636856403766975289505440883277824000000000000$$

permutations of the cards in all, your chances of winning are

$$\frac{1309302175551177162931045000259922525308763433362019257020678406144}{80658175170943878571660636856403766975289505440883277824000000000000}$$

$$=\frac{4610507544750288132457667562311567997623087869}{284025438982318025793544200005777916187500000000}$$

$$\approx0.0162\;.$$

-
Thank joriki this is extremely helpful – user51147 Nov 29 '12 at 16:24
I love that you have written out the numerator and denominator entirely as integers and not expressions. It is hauntingly beautiful in a way. – Patrick Dec 1 '12 at 17:33