You have a dice. Simulate the probability of picking a Picture card from a 52-card deck: $$ P(\text{Picture}) = \frac{3}{13} $$ while minimising the expected number of dice rolls.
We construct increasingly efficient schemes.
Roll two dice → 36 equally likely outcomes.
- Assign:
- 6 outcomes → True
- 20 outcomes → False
- 10 outcomes → reroll
Example mapping:
-
$(1, x)$ → True -
$(2, x), (3, x), (4, x), (5,1), (5,2)$ → False - Remaining → reroll
Expected number of rolls
Each iteration uses 2 rolls and succeeds with probability
Improve efficiency by avoiding unnecessary second rolls.
Strategy
-
Roll one die:
-
$1 \to$ True -
$2,3,4 \to$ False -
$5 \to$ need second roll -
$6 \to$ reroll
-
-
If first roll = 5:
- Second roll
$\le 2 \to$ False - Second roll
$3\text{–}6 \to$ reroll
- Second roll
Expected number of rolls
Per iteration: $$ \frac{5}{6}(1) + \frac{1}{6}(2) = \frac{7}{6} $$
Number of iterations: $$ \frac{36}{26} $$
Total: $$ \mathbb{E}[\text{rolls}] = \frac{36}{26} \cdot \frac{7}{6} \approx 1.62 $$
Target probability: $$ \frac{3}{13} \approx 0.231 $$
Each die roll partitions
Step 1
- If roll
$=1$ → True - If roll
$>2$ → False - If roll
$=2$ → refine
Step 2 (refinement)
Position within bucket: $$ \frac{0.23 - 1/6}{1/6} \approx 0.38 $$
So:
- If next roll
$<3$ → True - If next roll
$>3$ → False - If roll
$=3$ → repeat refinement
Expected number of rolls
Each step stops with probability
| Method | Expected Rolls |
|---|---|
| Level 1 | |
| Level 2 | |
| Level 3 |
The code for all the methods here can be found in ../Code/PictureCardProbability.py; this may make more sense
You are given the numbers
(a) What is the most efficient way to find the missing number?
(b) Now suppose two numbers are missing. What is the most efficient way to find the two missing numbers?
We use identities for sums of integers and sums of squares.
If all numbers were present, their sum would be
Let the observed list be
Take
Then
Hence the missing number is
Let the missing numbers be
We use two equations:
Sum: $$ a + b = \frac{n(n+1)}{2} - \sum_{x \in l} x $$
Sum of squares: $$ a^2 + b^2 = \frac{n(n+1)(2n+1)}{6} - \sum_{x \in l} x^2 $$
This gives a system of two equations in two unknowns.
Take
Compute totals:
So
Substitute
Solving:
Hence the missing numbers are
-
One missing number:
$$\frac{n(n+1)}{2} - \sum l$$ -
Two missing numbers:
Solve $$ a+b,\quad a^2+b^2 $$ via simultaneous equations.
A chess tournament has 128 players, each with a distinct rating. Assume that the player with the higher rating always wins against a lower rated opponent and that the winner proceeds to the subsequent round. What is the probability that the highest rated and second-highest rated players will meet in the final?
Consider the initial brackets. At the lowest level there are 128 players. The two players meet in the final if they don't meet earlier; they are on opposite sides of the draw. Place the top player. There are 127 remaining spots, 64 of which are on the opposite side of the draw. So, the answer is 64/127.