Solution
Either Twenty or Twenty-Three
Show the problem again
Alice and Bob are perfect logicians. Each has a positive integer written on their forehead; each sees the other's number but not their own. Both know that the sum of the two numbers is either 20 or 23, and this is common knowledge. A referee asks them alternately, starting with Alice: "Do you know the number on your own forehead?" Each answer is heard by both. The first seven answers (Alice, Bob, Alice, Bob, Alice, Bob, Alice) are all "no", and the eighth answer, from Bob, is "yes". What number is on Bob's forehead?
Worked solution
The answer is 10. Track the set of worlds (Alice's number, Bob's number) that remain possible. A player who sees m has two candidates for their own number, 20 − m and 23 − m, keeping only the positive ones. So Alice answers "yes" on question 1 exactly when Bob wears 20, 21 or 22 (leaving only the candidates 3, 2, 1). Hearing "no" eliminates those worlds; now Bob, seeing Alice's number, may find that one of his two candidates would have let Alice answer on question 1, which settles his number, and so on. Each question resolves a fresh block of worlds, and the blocks peel inwards from both ends of the range, alternately for Alice and Bob. Carrying the elimination through over all possible worlds shows that exactly the pairs (10, 10) and (13, 10) first produce a "yes" at the eighth question (from Bob). Every earlier question resolves other worlds, and the pairs that produce "yes" at question 7, for instance, are six different ones. In the surviving worlds Alice wears either 10 (sum 20) or 13 (sum 23), but in both of them Bob wears 10, so that is the answer. (Verified by a program that simulates the public announcements over all worlds.)
Source: Variant of the classic foreheads-and-numbers common-knowledge puzzle in wide circulation; no traceable original source. Statement written for AxiomIQ.