← Complete problem index

PROJECT EULER · #0687

Shuffling Cards

Statement only · UnsolvedOriginal problem ↗

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 432442510.1741176471.

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

Write-up coming later

The complete problem is available here. An approach, code, and answer will be added later.