Students with Hats

One teacher decided to test three of his students - Frank, Gary and Henry. The teacher took three hats, wrote on each hat an integer number greater than 0, and put the hats on the heads of the students. Each student could see the numbers written on the hats of the other two students but not the number written on his own hat.
The teacher said that one of the numbers is sum of the other two and started asking the students:

-- Frank, do you know the number on your hat?
-- No, I don't.
--Gary, do you know the number on your hat?
-- No, I don't.
--Henry, do you know the number on your hat?
-- No, I don't.

Then the teacher started another round of questioning:
-- Frank, do you know the number on your hat?
-- No, I don't.
--Gary, do you know the number on your hat?
-- No, I don't.
--Henry, do you know the number on your hat?
-- Yes, it is 144.

What were the numbers which the teacher wrote on the hats?


The numbers are 36, 108, 144.

After the first round of questioning, all students knew that all three numbers were different. After Frank and Gary got questioned for the second time, Henry could conclude that his number was not two times larger or smaller than any of the other two numbers. This was all the information he had, and since he answered correctly, then he must have noticed that one of the following is correct:

- the difference of Frank and Gary's numbers is twice the smaller one
- the difference of Frank and Gary's numbers is half the bigger one
- the sum of Frank and Gary's number is twice one of their numbers

The third option is impossible, since it will imply that Frank and Gary had the same numbers. The second option is impossible, because it will imply that the numbers Henry had the same number as Frank or Gary. Therefore, the three numbers were X, 3X, 4X, where 4X = 144. This implies that X = 36 and 3X = 108.