Project Euler Problem 744

"What? Where? When?" is a TV game show in which a team of experts attempt to answer questions.

Project Euler Problem 744

Solution

Answer: 0.0001999600

Let $q=1-p$.

Condition on the position of the RED card among the $2n+1$ envelopes.

If the RED card is at position $r$, then $r-1$ questions are answered before the game stops due to RED.

The game ends normally iff after those $r-1$ questions either the expert or the viewers have already reached $n$ points.

Equivalently, let $T$ be the number of questions needed until one side first reaches $n$ points. Then

$$f(n,p)=\Pr(\text{RED appears after time }T) = \frac{2n+1-\mathbb E[T]}{2n+1}.$$


For $p<\tfrac12$, the viewers almost surely reach $n$ first when $n$ is huge.

Here

$$p=0.4999,\qquad q=0.5001.$$

Ignoring exponentially tiny probabilities ($\sim e^{-cn}$) that the expert wins first, the stopping time is simply the time needed to obtain $n$ viewer points. That is a negative-binomial process with mean

$$\mathbb E[T]\approx \frac{n}{q}.$$

Hence

$$f(n,p)\approx \frac{2n+1-\frac{n}{q}}{2n+1}.$$

Substitute $n=10^{11}$, $q=0.5001$:

$$f(10^{11},0.4999) \approx \frac{2\cdot 10^{11}+1-\frac{10^{11}}{0.5001}} {2\cdot 10^{11}+1} = 0.000199960012997\ldots$$

Rounded to 10 decimal places:

Answer: 0.0001999600