P687
projecteuler.net

Shuffling Cards

ℹ️Published on Saturday, 2nd November 2019, 10:00 pm; Solved by 345;
Difficulty rating: 45%

A standard deck of $52$ playing cards, which consists of thirteen ranks (Ace, Two, ..., Ten, King, Queen and Jack) each in four suits (Clubs, Diamonds, Hearts and Spades), is randomly shuffled. Let us call a rank perfect if no two cards of that same rank appear next to each other after the shuffle.

It can be seen that the expected number of ranks that are perfect after a random shuffle equals $\frac {4324} {425} \approx 10.1741176471$.

Find the probability that the number of perfect ranks is prime. Give your answer rounded to $10$ decimal places.



Soluzione

Last modified: May 01, 2025. Website built with Franklin.jl and the lovely Julia programming language.