You and two other people have numbers written on your foreheads. You are all told that the three numbers are primes and that they form the sides of a triangle with a prime perimeter. You see 5 and 7 on the other two heads and both of the other people agree that they cannot deduce the number on their own foreheads.

What is the number written on your forehead?

(In reply to

to jason, why your answer is wrong by Michael)

I must have a 5.

I can't have a 3: 3 + 5 + 7 = 15, not prime.

If I had an 11 then then the fellow with the 7 would see 5 and 11. leaving only the choices of 3 or 7 for his number. Since the triangle 3,5,11 is impossible 7's owner would be able to determine his own number.

If I had a 7 then then 5's owner would see 7,7. He could only choose a 3 or 5 for the prime perimeter. If he has a 3 then he knows 7's owner would see 3,7. Thus 7's choices would be 3 or 7. Since 3,3,7 is not a possible triangle then 7's owner would know his own number is 7. Thus in order for 7's owner to be left in the dark 5's owner is left with 5. So in either case one of them can determine their own number.

Finally if I have a 5 then 5's owner sees 7,5 and 7's owner sees 5,5. - 7,5 can be completed with 5,7 or 11 while 5,5 can be completed with 3 or 7. 5 has 2 viable choices : 5 or 7 which are ambiguous for 7's owner; while both of 7's choices - 3 or 7 are ambiguous from 5's point of view.