# One hat's number is the sum of the other 2. How did A figure out his hat number?

In the October 2003 issue of MIT Technology Review, Donald Aucamp offered this conundrum:

Three logicians, A, B, and C, are wearing hats. Each hat displays a positive integer, and each logician can see their companions’ numbers but not their own.

All of them know that the numbers are positive integers and that one of the numbers is the sum of the other two. The three then take turns(in the order of A, B and C) to see who can determine his number first. In the first round, all three pass, but in the second round, A correctly states their number is 50. What are the other two numbers, and how did A know that theirs was 50?

P.S: Please show your thinking process also and how you arrived at the answer. I am a teacher and have to present the answer to this question to 8th graders.

All the answers here and on the internet are just stating the final answer without much details. For example, everywhere I have read on the internet simply state the following without providing any explanation why this is: A only wins if the numbers are in ratio (2,1,1).

• Do they all three pass simultaneously, or do they pass one by one? For instance, the first time that B passes, does he now that A has passed? Commented Jul 23 at 14:38
• @Servaes , they pass one by one and everybody can hear everybody else. Commented Jul 23 at 14:43
• With positive integer you don't allow 0, right? Or do you? Now, if not allowed and if first round A sees multiple of 1 1 then A knows to have corresponding multiple of 2 (because having 0 is not allowed). Commented Jul 23 at 15:10
• @nocomment as written above one by one more in particular A B C Commented Jul 23 at 22:32
• Minor nitpick about the problem statement - the conditions on the numbers should be specified as common knowledge - i.e. not just "everyone knows X", but also "everyone knows that everyone knows X", "everyone knows that everyone knows that everyone knows X", etc. Commented Jul 24 at 14:24

Assuming, in each round, they are asked in turn: A, B, C, as opposed to simultaneously.

A person can win in a round if either
- The other two numbers are equal
- If that person's number is not the sum of two other numbers, somebody else would have claimed in a previous round.

First round, A only wins if the numbers are in ratio (2,1,1).
First round, B wins if numbers are in ratio (1,2,1) or (2,3,1). (For the latter case, B knows the numbers are (2,1,1) or (2,3,1); if they are (2,1,1) then A would have claimed.)
First round, C wins if numbers are in ratio (1,1,2), (2,1,3), (1,2,3), or (2,3,5).
Second round, A wins if numbers are in ratio (3,2,1), (4,3,1), (3,1,2), (4,1,3), (5,2,3), or (8,3,5).
A has 50, which is not divisible by 3, 4, or 8, but is divisible by 5. So if A announces on the second round, they can only be 50, 20, 30.

• How did you figure out that for A to win the ratio is 2,1,1. For B to win the ratio is 1,2,1 or 2,3,1 ? Pls give a more detailed and intuitive answer. Commented Jul 23 at 13:54
• A may have seen two 25's on the first round and simply chose not to answer then, knowing he'd still be able to win the second round. Commented Jul 23 at 20:55
• @HemantAgarwal A knows that one of the hats has the number that's the sum of the other two. If he sees that hat B and hat C have the same value X, then that means either his own hat has 0 (so hat A + hat B = hat C) or his own hat has 2X (so hat B + hat C = hat A). Since no hat can have 0, that would only leave the second possibility. Thus we know that a ratio of (2,1,1) would let A figure out his own hat's value. For any other set of numbers, he can't know without more information if his hat is |hat B - hat C| or hat B + hat C. Thus we know any other ratio wouldn't. Commented Jul 23 at 22:11
• @HemantAgarwal This sort of logic is also why B wins if the ratio is either (1,2,1) or (2,3,1). If the ratio is (1,2,1), then he can just use the same logic as A. If the ratio is (2,3,1), then since he can see A and C, he knows the ratio must be (2,X,1) with X either 1 (2 - 1) or 3 (2 + 1). And since B also knows that A didn't win immediately, X can't be 1, so he knows X must be 3 and his own hat is A + C. Commented Jul 23 at 22:21
• @HemantAgarwal The rest of the answer is then just continuing this logic from there in figuring out which ratios, knowing that A and B didn't win, would have let C win immediately, and which ratios, knowing B and C didn't win after his turn, would let A win immediately. Then, since we know A's hat has 50, we can figure out exactly which ratio is possible by what hats he saw and which ratio they must've matched. Commented Jul 23 at 22:26

Hopefully clearer explanation of ralphmerridew's reasoning:

All three numbers are positive integers, and one is the sum of the other two. So if yours isn't the sum of the others, then the only way to satisfy the second condition is if the larger of the others is the sum of yours and the smaller of the others, i.e. if yours is the difference of the others. So by seeing the other two numbers, you already know at the start that yours is either their sum or their difference.

Thus, we get the first condition:

* A person can win in a round if the other two numbers are equal.

Because if the other two numbers are both N, then yours is either 2N or 0, but 0 isn't a positive integer.

The second condition, in a simpler form, is:

* If one of your two options was the case, then someone else would have won already; but they didn't, so it must be the other option.

So, from the beginning:

If the ratios were A:B:C = 2:1:1, then A would have won in the first round (condition #1). He didn't, so we (and B and C) can rule this out.

If the ratios were 1:2:1, then B would have won in the first round (condition #1). Also, if the ratios were 2:3:1, then B (knowing it's 2:something:1 based on what he sees) would know that they were either 2:3:1 or 2:1:1 (and 2:1:1 was ruled out above), so B would have won in the first round (condition #2). He didn't, so we (and A and C) can also rule out 2:3:1.

If the ratios were 1:1:2, then C would have won in the first round (condition #1). Also, since C didn't win by condition #2:

* Since 2:1:1 was ruled out, it couldn't be 2:1:3.

* Since 1:2:1 was ruled out, it couldn't be 1:2:3.

* Since 2:3:1 was ruled out, it couldn't be 2:3:5.

Now we get to round two. A still can't win based on condition #1, but this time he does win based on condition #2, which must be based on one of the ratios ruled out above.

* If this was based on 2:1:1 being ruled out, then the other option would be 0:1:1 (already ruled out as well).

* If this was based on 1:2:1, then the other option would be 3:2:1.

* If this was based on 2:3:1, then the other option would be 4:3:1.

* If this was based on 1:1:2, then the other option would be 3:1:2.

* If this was based on 2:1:3, then the other option would be 4:1:3.

* If this was based on 1:2:3, then the other option would be 5:2:3.

* If this was based on 2:3:5, then the other option would be 8:3:5.

But we know that A's number is 50, so the only set of ratios producing three integers is 5:2:3 (i.e. B has 20 and C has 30).