Coin Flips Needed to Simulate a Fair Die

Coding
Randomness
Medium
Using only independent fair coin flips, one method to simulate a fair six-sided die generates three bits, interprets them as an integer from to , accepts values through , and rejects or by repeating. What is the expected number of coin flips required per accepted die roll?
Hint 1

Each block of three flips independently succeeds with probability .

Hint 2

The number of blocks needed is geometric; multiply its expectation by the number of flips per block.

Show worked solution
  1. 1. Find the block success probability

    Each three-bit block encodes a value in uniformly, and only of the outcomes are accepted.

  2. 2. Expected number of blocks and flips

    The number of blocks needed is geometric with success probability , so its expectation is ; each block costs three flips.

Answer: 4

Related roles: Browse quant jobs

Related problems