Teaser 2988: Open the box
From The Sunday Times, 29th December 2019 [link] [link]
Game show contestants are shown a row of boxes, each containing a different sum of money, increasing in regular amounts (eg, £1100, £1200, £1300, …), but they don’t know the smallest amount or the order. They open one box then take the money, or decline that and open another box (giving them the same choices, apart from opening the last box when they have to take the money).
Alf always opens boxes until he finds, if possible, a sum of money larger than the first amount. Bert’s strategy is similar, except he opens boxes until he finds, if possible, a sum of money larger than both of the first two amounts. Remarkably, they can both expect to win exactly the same amount on average.
How many boxes are there in the game?
[teaser2988]




Jim Randell 4:37 pm on 27 December 2019 Permalink |
With k boxes, we always win a base amount, along with some multiple of the increment. So we can just consider the boxes to take on the values from 1 to k.
This Python program considers increasing numbers of boxes, looking at the total winnings for A and B for all possible arrangements of boxes. Until it finds two totals with the same value. It runs in 75ms.
Run: [ @repl.it ]
from enigma import (subsets, irange, inf, printf) # strategy, take the first amount larger than the first n boxes def strategy(s, n): t = max(s[:n]) for x in s[n:]: if x > t: break return x # strategies for A and B A = lambda s: strategy(s, 1) B = lambda s: strategy(s, 2) # play the game with k boxes def play(k): # collect total winnings for A and B tA = tB = 0 # consider possible orderings of the boxes for s in subsets(irange(1, k), size=k, select="P"): tA += A(s) tB += B(s) return (tA, tB) for k in irange(3, inf): (tA, tB) = play(k) if tA != tB: continue printf("{k} boxes") breakSolution: There are 6 boxes.
For 3 to 5 boxes A’s strategy is better than B’s. When there are more than 6 boxes B’s strategy is better.
Using prizes with values from 1..k I found that the average winnings for A and B are:
In general we have:
So, as k increases the ratio of A’s average approaches 3/4 (= 75.0%) of the maximum available prize. And the ratio of B’s average approaches 5/6 (= 83.3%) of the maximum prize.
From the equations we see that the average winnings are the same when:
In general a strategy of looking at n values and then taking the next highest value gives average winnings from k boxes according to the following formula:
So: A(k) = S(1, k) and B(k) = S(2, k).
LikeLike