TITLE: Derangements with repetitive numbers
QUESTION [5 upvotes]: 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 its 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?

REPLY [6 votes]: 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\;.
$$
See also What's the General Expression For Probability of a Failed Gift Exchange Draw, Laguerre polynomials and inclusion-exclusion and Counting some special derangements.