← Complete problem index

PROJECT EULER · #0856

Waiting for a Pair

Statement only · SolvedOriginal problem ↗

A standard 52-card deck comprises 13 ranks in four suits. A pair is a set of two cards of the same rank.

Cards are drawn, without replacement, from a well shuffled 52-card deck waiting for consecutive cards that form a pair. For example, the probability of finding a pair in the first two draws is 117.

Cards are drawn until either such a pair is found or the pack is exhausted waiting for one. In the latter case we say that all 52 cards were drawn.

Find the expected number of cards that were drawn. Give your answer rounded to eight places after the decimal point.

Write-up coming later

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