The answer is 11. Before constructing the argument, let's look at

some cases of what the possibilities are for various sample pairs of

numbers seen on the other two heads. Given two numbers, B and C,

we know that A must be prime, A+B+C must be prime, and |C-B|<=A<=B+C

(triangle inequality -- no side can be longer than the sum of the other

two sides, or the sides cannot meet).

Person sees:

I) 5/7, poss are 5/7/11

II) 5/5, poss are 3,7

III) 7/7, poss are 3,5

IV) 5/11, poss are 7,13

V) 7/11, poss are 5/11/13

VI) 3/5, poss are 3/5

VII) 3/3, poss are 5 only

VIII) 3/7, poss are 7 only

IX) 11/11, poss are 7/19

X) 11/13, poss are 5/7/13/17/19/23

So, we see that the larger the numbers, the more possibilities there are,

since the range of values for the third side become larger. This is not

a proof, which would be tedious, but a guideline for constructing an argument.

Terminology:

Person A refers to the person guessing.

Person B refers to the person with a 5.

Person C refers to the person with a 7.

"Person X sees #/#" means that that person sees those numbers on the other two heads.

"Playing a #/#/# game" means that we are considering a hypothetical setup where

A has the first number, B has the second, C has the third.

Structure of the Argument:

Person X can see two numbers and then figure out what possible numbers he is.

Then Person X considers each possibility in turn. For any specific possibility,

he knows what Person Y would see in that case and reasons out what Y would

reason out, including what Y reasons about what Z must be seeing, and so on.

Interpretation/Problem Clarification:

"both of the other people agree that they cannot deduce the number on

their own foreheads" will be taken to mean that C gets to say his

number if he knows it or pass, then B gets to say his number if he

knows it or pass, then C gets *another* turn, then B, and so on until

both reason that the answer is not knowable and give up. In the

argument, we will rely on C being given a second turn before A decides.

On to the actual argument:

Person A sees 5/7.

Person A knows he is 5, 7, or 11.

I) Person A supposes he is a 5 playing a 5/5/7 game.

Then Person C (with the 7) sees 5/5 and knows he is 3 or 7.

A) Person C can suppose that he is playing a 5/5/3 game.

Person B would then see 3/5 and know he is 3 or 5.

1) Person B can suppose he is a 3, playing 3/3/5.

Then Person C would see 3/3 and know he is a 5

So when Person C says that he knows what he is,

Person B knows that he is not playing this 3/3/5 game.

2) After Person C says he does not know, Person B knows he is a 5.

Once C says he does not know and B says he does not know,

Person C knows that he is not playing the 5/5/3 game.

B) Once C says he does not know and B says he does not know,

C knows he is a 7. So, once C says he does not know and

B says he does not know, and C says he does not know,

A knows that he is not a 5.

II) Person A supposes he is a 7 playing a 7/5/7 game.

Then person B sees 7/7 and knows he is 3 or 5.

A) Person B can suppose he is a 3 playing a 7/3/7 game.

Then person C sees 7/3 and knows he is a 7.

Once C announces that he does not know, then B knows he is not a 3.

B) Once C announces that he does not know, then B knows he is a 5.

Once C says he does not know and B says he does not know, A knows he is not a 7.

III) By elimination, Person A knows he is 11

Why doesn't this argument eliminate 11 as well?

Allow me to be slightly less formal and less exhaustive:

III) Person A supposes he is an 11 playing an 11/5/7 game.

Person C (with the 7) sees 11/5 and knows he is 7 or 13.

A) Person C supposes he is a 7 playing a 11/5/7 game.

Then B sees 11/7 and knows he is 5, 11, or 13.

1) B supposes he is a 5 playing a 11/5/7 game.

C sees
11/5 and knows he is 7 or 13. We have argued back to our original
case.

2) B supposes he is a 11 playing a 11/11/7 game.

C sees 11/11 and knows he is 7 or 19.

1) C supposes he is a 7 playing 11/11/7.

B sees 11/7 and knows he is 5, 11 or 13. We have argued back here
again.

So, B has no way of knowing which, so C *could* be a 7.

B) Person C supposes he is a 13 playing a 11/5/13 game.

Person B sees 11/13, so he knows he is 5, 7, 13, 17, 19, 23.

1) B supposes he is a 55 playing 11/5/13

C sees
11/5 and knows he is 7 or 13. We have argued back here again.

So C doesn't know if he is 7 or 13.

So A could conceivably be a 11.