You're playing a betting game where you continually roll a 6-sided die. If you roll two prime numbers in a row, the game ends. Until then, you get x dollars at each roll, where x is the number of rolls that have occurred so far. For example, if it takes 5 rolls before 2 primes are seen in a row (i.e. on rolls 4 and 5), then you take home $1 + $2 + $3 + $4 = $10. If entry costs $15, Would you buy into this game?
Solution
Answer: Yes
Let a “prime roll” mean rolling one of
\[
2,3,5,
\]
so on any roll,
\[
P(\text{prime})=\frac{3}{6}=\frac12.
\]
That makes the game easier to think about: each roll is basically a \(50/50\) chance of being
\[
\text{prime} \quad \text{or} \quad \text{not prime}.
\]
The game stops the first time you see two prime rolls in a row.
The cleanest way to analyze this is to keep track of what just happened.
If the previous roll was not prime, or we are just starting, call that the “safe” state.
If the previous roll was prime, call that the “danger” state, because one more prime ends the game.
Let \(E_0\) be the expected number of rolls left from the safe state, and \(E_1\) from the danger state.
From the safe state, one roll happens for sure. After that:
- with probability \(\frac12\), you rolled a prime, so you move to the danger state
- with probability \(\frac12\), you rolled a non-prime, so you stay in the safe state
So
\[
E_0 = 1 + \frac12 E_1 + \frac12 E_0.
\]
From the danger state, one roll also happens for sure. After that:
- with probability \(\frac12\), you roll another prime and the game ends
- with probability \(\frac12\), you roll a non-prime and go back to the safe state
So
\[
E_1 = 1 + \frac12(0) + \frac12 E_0.
\]
Solving these gives
\[
E_0 = 6, \qquad E_1 = 4.
\]
So on average, the game lasts \(6\) rolls.
But your payout is not just the number of rolls.
If the game ends on roll \(N\), you earn
\[
1+2+\cdots+(N-1)=\frac{(N-1)N}{2}.
\]
So we need the expected value of
\[
\frac{(N-1)N}{2}.
\]
That means we need \(E[N^2]\) as well.
Let \(S_0 = E[N^2]\) starting from the safe state, and \(S_1\) from the danger state.
Using the same state idea,
\[
S_0 = 1 + (E_0+E_1) + \frac12 S_0 + \frac12 S_1,
\]
and
\[
S_1 = 1 + E_0 + \frac12 S_0.
\]
Substituting \(E_0=6\) and \(E_1=4\) and solving gives
\[
S_0 = 58.
\]
So
\[
E[N]=6, \qquad E[N^2]=58.
\]
Now compute the expected payout:
\[
E\!\left[\frac{(N-1)N}{2}\right]
=
\frac{E[N^2]-E[N]}{2}
=
\frac{58-6}{2}
=
26.
\]
So the expected amount you take home is
\[
\$26.
\]
Since the entry fee is only
\[
\$15,
\]
the expected profit is
\[
26-15 = 11.
\]
Since $11 > $0, this game is worth buying into.