# A prisoner and two dice

A prisoner is offered the following deal. They will be given a pair of standard 6-sided dice to roll. If they can roll a total of 42 or more without rolling a double then they will be set free. Otherwise if they roll a double before reaching 42 then they will be executed. If they don't accept the deal then they will stay in prison forever. Should they accept the deal?

• hmmm? if the prisoner does not take the deal what will happen to the prisoner? Apr 24, 2023 at 6:19
• Without stating the default condition, this question cannot be answered. Will they continue to stay in prison if they don't accept the deal? Or if they will be executed anyway, then it is a no-brainer to accept. Apr 24, 2023 at 11:53
• In order to answer, we need to know the utility of how the prisoner values freedom, continued incarceration, and death. If the prisoner is enduring unending daily torture at a black site, they might roll the dice no matter what, if they have an hour left in the drunk tank at county jail, they obviously will not. Apr 24, 2023 at 14:12
• added what happens if they don't accept the deal Apr 24, 2023 at 14:27

The prisoner should

accept the deal if they value a 31.03744% chance of freedom over a 100% chance of confinement.

I calculated this number with some basic dynamic programming—using the chances that the prisoner would be alive at any given score $$n$$ and combining those numbers (weighted by the probability of rolling each non-double result) to calculate further chances. Run or view it online to see the rather simple algorithm.

• Hmmm that's a pretty high chance of death, not sure I would take that risk. Apr 23, 2023 at 1:18
• I got the same answer, so this is correct! Apr 23, 2023 at 13:59

Using the same idea as @AxiomaticSystem's answer, but calculating it exactly:

The odds of hitting a given running total $$n$$ without being executed can, when $$1 \le n \le 44$$, be expressed as the recursive equation:

\begin{align} p_n = &\frac{2}{36} \cdot p_{n-11} + \frac{2}{36} \cdot p_{n-10} + \frac{4}{36} \cdot p_{n-9} \\\\ & + \frac{4}{36} \cdot p_{n-8} + \frac{6}{36} \cdot p_{n-7} + \frac{4}{36} \cdot p_{n-6} \\\\ & + \frac{4}{36} \cdot p_{n-5} + \frac{2}{36} \cdot p_{n-4} + \frac{2}{36} \cdot p_{n-3} \end{align}

Each of these terms is the probability of a single roll moving the total from from $$n-k$$ to $$n$$, without rolling a double, times the probability of reaching $$n-k$$ in the first place.
We can define $$p_{n \lt 0} = 0$$ (as negative totals can never be reached) and $$p_0 = 1$$ (as that is the starting value, which will always be reached).

When $$n \gt 44$$ the probability function changes, as no more rolls are made once the sum has reached 42. This eliminates any terms involving $$p_{n\ge42}$$. This changes the probability function to:

\begin{align} p_{45} &= \frac{2}{36} p_{34} + \frac{2}{36} p_{35} + \frac{4}{36} p_{36} + \frac{4}{36} p_{37} + \frac{6}{36} p_{38} + \frac{4}{36} p_{39} + \frac{4}{36} p_{40} + \frac{2}{36} p_{41} \\\\ p_{46} &= \frac{2}{36} p_{35} + \frac{2}{36} p_{36} + \frac{4}{36} p_{37} + \frac{4}{36} p_{38} + \frac{6}{36} p_{39} + \frac{4}{36} p_{40} + \frac{4}{36} p_{41} \\\\ p_{47} &= \frac{2}{36} p_{36} + \frac{2}{36} p_{37} + \frac{4}{36} p_{38} + \frac{4}{36} p_{39} + \frac{6}{36} p_{40} + \frac{4}{36} p_{41} \\\\ p_{48} &= \frac{2}{36} p_{37} + \frac{2}{36} p_{38} + \frac{4}{36} p_{39} + \frac{4}{36} p_{40} + \frac{6}{36} p_{41} \\\\ p_{49} &= \frac{2}{36} p_{38} + \frac{2}{36} p_{39} + \frac{4}{36} p_{40} + \frac{4}{36} p_{41} \\\\ p_{50} &= \frac{2}{36} p_{39} + \frac{2}{36} p_{40} + \frac{4}{36} p_{41} \\\\ p_{51} &= \frac{2}{36} p_{40} + \frac{2}{36} p_{41} \\\\ p_{52} &= \frac{2}{36} p_{41} \\\\ p_{53} &= 0 \\\\ p_{54} &= 0 \\\\ &\dots \end{align}

From this we can finally calculate the probability we are interested in. As we are interested in the probability of hitting any sum $$n \ge 42$$, the probability we are interested in is

$$P = \sum_{n=42}^{\infty} p_n = \sum_{n=42}^{52} p_n$$

Which we can calculate using numerical programming to be

$$P=\frac{2560089501515713}{8248389385254061} \approx 0.3103744721475$$

This is the exact probability that the prisoners win, which is in agreement with @AxiomaticSystem's approximate answer.

• Well done! This is very impressive. Apr 24, 2023 at 14:28