Sunday Times Teaser 2988 – Open the Box
by John Owen
Published December 29 2019 (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?
-
Brian Gladman permalink123456789101112131415161718from itertools import count, permutations# consider an increasing number of boxes starting at 3for n in count(3):# calculate the winnings for the two strategies over# all arrangements of n boxess = [0, 0]for p in permutations(range(n)):for i, c in enumerate((p[0], max(*p[:2]))):for x in p:if x > c:breaks[i] += xif s[0] == s[1]:print(f"There are {n} boxes in the game.")break