This article is from the Puzzles FAQ, by Chris Cole chris@questrel.questrel.com and Matthew Daly mwdaly@pobox.com with numerous contributions by others.
Two logicians place cards on their foreheads so that what is written on the
card is visible only to the other logician. Consecutive positive integers
have been written on the cards. The following conversation ensues:
A: "I don't know my number."
B: "I don't know my number."
A: "I don't know my number."
B: "I don't know my number."
... n statements of ignorance later ...
A or B: "I know my number."
What is on the card and how does the logician know it?
logic/smullyan/integers.s
If A saw 1, she would know that she had 2, and would say so. Therefore,
A did not see 1. A says "I don't know my number."
If B saw 2, she would know that she had 3, since she knows that A did not see
1, so B did not see 1 or 2. B says "I don't know my number."
If A saw 3, she would know that she had 4, since she knows that B did not
see 1 or 2, so A did not see 1, 2 or 3. A says "I don't know my number."
If B saw 4, she would know that she had 5, since she knows that A did not
see 1, 2 or 3, so B did not see 1, 2, 3 or 4. B says "I don't know my number."
... n statements of ignorance later ...
If X saw n, she would know that she had n + 1, since she knows that ~X did not
see 1 ... n - 1, so X did see n. X says "I know my number."
And the number in n + 1.
 
Continue to: