# Three secret numbers and sum

Three students are given one positive integer number each written on a paper. Every student knows only their own number. Their teacher tells them that the total sum is 16. Later the teacher asks them what they think about the numbers of their classmates.

The first student says he knows that the two other students have different numbers.

After hearing that the second says now he knows everyone has different numbers.

After hearing the statement of the second student the third says that now he knows everyone's number.

What are the values of the three numbers?

p.s. There are two solutions to the problem.I apologise for my negligence.I explain everything to the comments below stiv's solution.

• Does everyone involved know that these numbers are: integers, positive numbers, etc? Jun 25, 2020 at 19:40
• you are right.They are all positive integers. Jun 25, 2020 at 19:43
• Is it given that the second student cannot know the value of everyone's numbers? Jun 26, 2020 at 17:44
• @Jason Goemaat yes, the second student does not know the value of the other two Jun 27, 2020 at 13:31

I think this works, although it results in two possible solutions that I believe meet all the criteria...

The first student says that he knows that the two other students have different numbers, because:

He must have an odd number. Thus if all three numbers sum to 16 then the second and third students must have one odd number and one even number between them, in order to obtain the even-numbered total.

After hearing that the second says now he knows everyone has different numbers, because:

He has an even number which is a multiple of 4. If this student is the one who has the only even number then he now knows both of the others have odd numbers, and furthermore because his number is divisible by 4 (i.e. one of 4, 8 or 12), the difference between his number and the total 16 must also be divisible by 4 (being one of 12, 8 or 4), meaning it cannot be exactly halved into two of the same odd number (i.e. half of 4 is 2, half of 8 is 4, and half of 12 is 6). (NB Before the first student made their statement, thereby revealing they held an odd number, the second student could not be sure whether both the first and third students had the same even number or not...)

After hearing the statement of the second student the third says that now he knows everyone's number, because:

His (odd) number is 9 or 11. The third student realises from the second player's statement that he holds a number divisible by 4, already knowing the first student has an odd number. In order for him to therefore know both the other two numbers his number must be high enough that the second player's number only has one possible option, i.e. the second student must have the number 4.

Thus the numbers held by the three players, respectively, are:

Either 3, 4 and 9... or 1, 4 and 11.

• @Craftsman Okay, well can you point out the flaw in my solution as per the definition of the puzzle? I'm struggling to see it myself and would love to know... Thanks :)
– Stiv
Jun 25, 2020 at 21:19
• I agree because rot13(vs gur frpbaq crefba unf na bqq ahzore gurer vf ab jnl gurl jbhyq or fher gung gurve ahzore vf qvssrerag sebz gur svefg crefba'f. Gur gubhtug nobhg n zhygvcyr-bs-sbhe rira ahzore vf n ernyyl avpr bar v zvffrqj.) Jun 25, 2020 at 22:28
• @Stiv, I commented on the other answer on what the correct reasoning should be. So what's missing from your solution (which does not invalidate your existing answer) is the possibility that #2 is high odd. So there is another case, which as shown by the other answer, also leads to a valid solution. So unfortunately there are 3 solutions to this puzzle then. Jun 26, 2020 at 6:21
• @justhalf If #2 is high and odd then #2 will know in advance that the students all have different numbers whereas the question seems to suggest that they only know this after hearing #1's statement. See bipll's comment on the other answer. Jun 26, 2020 at 9:23
• @TheDemonix_Hermit Thanks for the reply, but that case wouldn't work for all the logic. If second has 12, then third must have 1 or 3. Armed with only the knowledge that they hold 1 or 3 themselves plus knowing that first is odd and second is divisible by 4, the third student cannot identify that the second actually has 12 in their possession - for all #3 knows, they could equally have 4 or 8, with the difference made up by student 1's (also unknown) odd number. Hence why #3 has to have a high enough number to narrow down #2's options... Tricksy stuff, this!
– Stiv
Jun 26, 2020 at 11:39

The numbers may be

1, 9, and 6 respectively.

Student #1's statement:

If student #1 knows that Student #2 and #3 do not share a number, it means that student #1 must have an odd number. If he had a even number, it would allow for student #2 and #3 to share an integer = (16-student 1 number)/2, for any even integer that student #1 might have.

Student #2's statement:

Student #2 now knows that student #1 has a odd number. Since he knows that student #1 and #3 do not share a number, that means that student #2 must also have an odd number with the same logic from clue 1. This lets student #3 have an even number. If student #2 knows that he does not share a number with student #1, then one of their two odd numbers must be larger than half of 16. If student #2's number is larger than 8 and odd, then he knows that student #1 cannot have a matching odd number. He and student #1 could not both have a 9, because that would exceed the limit of 16.

Student #3's statement:

Student #3 knows that student #1 and #2 have odd numbers and that student 2's number is larger than 8 and student 1's number is less than 8. This means that the in order to know what student #1 and #2 have, student 3 must have 6 to allow student #1 to have 1 and student #2 to have 9. This is the only number that student #3 can have in order to have 1 decisive solution. If student 2 must have 9, 11, or 13, this means that Student #1 has 1, 3 or 5 and student #3 has 2, 4 or 6. Since student #3 can only have 6 if student A has 1 and Student B has 9 this is the only solution that allows student #3 to know each of the students respective numbers.

• If student #2 had an odd number, student #2 could have no way of knowing that they did not share an odd number with student #1
– user69943
Jun 26, 2020 at 0:35
• @DanielC. I found a way that student #2 could indeed know rot13(Fghqrag #2 jbhyq xabj gung ur qbrf abg funer na bqq ahzore jvgu fghqrag #1 vs uvf ahzore vf ynetre guna 8. Ur naq fghqrag #1 pbhyq abg obgu unir n 9, orpnhfr gung jbhyq rkprrq gur yvzvg bs 16.) Jun 26, 2020 at 1:00
• I reckon this is the OP's intended solution. Upvoted last night and still makes sense to me next morning... Funny how we both found ways to make this work with #2 being the opposite odd/even!
– Stiv
Jun 26, 2020 at 5:46
• If student #2 has 9, it knows all the numbers are different before student #1's answer. Jun 26, 2020 at 8:43
• @bipll That is a very valid point. Well put. (And hexomino on the other answer...)
– Stiv
Jun 26, 2020 at 9:44

Revised solution, thanks to a comment elsewhere by bipll, quoted later.

The approach here is presented for fun (given a spatially-convenient text editor) even though it leads to the same solution already reached by Stiv.

This puzzle is nicely scaled to allow a neat layout of possible solutions.


14 |  1                                 A = First student's number
13 |  2   1                             B = Second student's number
12 |  3   2   1                         C = Third student's number
11 |  4   3   2   1
10 |  5   4   3   2   1
9 |  6   5   4   3   2   1                A is shown here for each
8 |  7   6   5   4   3   2   1               possible combination
B    7 |  8   7   6   5   4   3   2   1              of B and C so that
6 |  9   8   7   6   5   4   3   2   1             A + B + C = 16
5 | 10   9   8   7   6   5   4   3   2   1
4 | 11  10   9   8   7   6   5   4   3   2   1
3 | 12  11  10   9   8   7   6   5   4   3   2   1
2 | 13  12  11  10   9   8   7   6   5   4   3   2   1
1 | 14  13  12  11  10   9   8   7   6   5   4   3   2   1
|_________________________________________________________
1   2   3   4   5   6   7   8   9   10  11  12  13  14

C

• The first student (A) says he knows that the two other students (B and C) have different numbers.

This eliminates the layout’s entries along the diagonal where B = C, shown in ( ) parentheses.

      14 |  1
13 |  2   1
12 |  3   2   1
11 |  4   3   2   1
10 |  5   4   3   2   1           A
9 |  6   5   4   3   2   1
8 |  7   6   5   4   3   2   1
B    7 |  8   7   6   5   4   3  (2)  1
6 |  9   8   7   6   5  (4)  3   2   1
5 | 10   9   8   7  (6)  5   4   3   2   1
4 | 11  10   9  (8)  7   6   5   4   3   2   1
3 | 12  11 (10)  9   8   7   6   5   4   3   2   1
2 | 13 (12) 11  10   9   8   7   6   5   4   3   2   1
1 |(14) 13  12  11  10   9   8   7   6   5   4   3   2   1
|_________________________________________________________
1   2   3   4   5   6   7   8   9   10  11  12  13  14

C


But if A = any of these parenthesized ( ) numbers, the first student (A) could not have made their statement. This eliminates another whole set of diagonals where A = one of these parenthesized ( ) numbers. The other two students, and we, can deduce as much.

      14 |  1
13 |  -   1
12 |  3   -   1
11 |  -   3   -   1
10 |  5   -   3   -   1           A
9 |  -   5   -   3   -   1
8 |  7   -   5   -   3   -   1
B    7 |  -   7   -   5   -   3  (-)  1
6 |  9   -   7   -   5  (-)  3   -   1
5 |  -   9   -   7  (-)  5   -   3   -   1
4 | 11   -   9  (-)  7   -   5   -   3   -   1
3 |  -  11  (-)  9   -   7   -   5   -   3   -   1
2 | 13  (-) 11   -   9   -   7   -   5   -   3   -   1
1 | (-) 13   -  11   -   9   -   7   -   5   -   3   -   1
|_________________________________________________________
1   2   3   4   5   6   7   8   9   10  11  12  13  14

C

• After hearing that, the second (B) says now he knows everyone has different numbers.

This eliminates entries where A = B along a row as well as where A = C in a column, shown again in ( ) parentheses.

      14 | (1)
13 |  .   1
12 |  3   .   1
11 |  .   3   .   1
10 |  5   .  (3)  .   1           A
9 |  .   5   .   3   .   1
8 |  7   .   5   .   3   .   1
B    7 |  .  (7)  .   5   .   3   .   1
6 |  9   .   7   .  (5)  .   3   .   1
5 |  .   9   .   7   .  (5)  .   3   .   1
4 | 11   .   9   .   7   .   5   .   3   .   1
3 |  .  11   .   9   .   7   .   5   .  (3)  .   1
2 | 13   .  11   .   9   .  (7)  .   5   .   3   .   1
1 |  .  13   .  11   .   9   .   7   .   5   .   3   .  (1)
|_________________________________________________________
1   2   3   4   5   6   7   8   9   10  11  12  13  14

C


But if any row of B includes one of these newly parenthesized ( ) entries, the second student (B) could not have made their statement. This eliminates a few rows, as the other two students and we can again deduce.

       - | (-)
13 |  .   1
12 |  3   .   1
11 |  .   3   .   1
- |  -   -  (-)  -   -           A
9 |  .   5   .   3   .   1
8 |  7   .   5   .   3   .   1
B    - |  -  (-)  -   -   -   -   -   -
- |  -   -   -   -  (-)  -   -   -   -
- |  -   -   -   -   -  (-)  -   -   -   -
4 | 11   .   9   .   7   .   5   .   3   .   1
- |  -   -   -   -   -   -   -   -   -  (-)  -   -
- |  -   -   -   -   -   -  (-)  -   -   -   -   -   -
- |  -   -   -   -   -   -   -   -   -   -   -   -   -  (-)
|_________________________________________________________
1   2   3   4   5   6   7   8   9   10  11  12  13  14

C

• After hearing the statement of the second student the third (C) says that now he knows everyone’s number.

This can happen only if the column of C contains exactly one remaining possibility.

       . |  .
13 |  .   1
12 |  3   .   1
11 |  .   3   .   1
. |  .   .   .   .   .           A
9 |  .   5   .   3   . | 1 |
8 |  7   .   5   .   3 | . | 1
B    . |  .   .   .   .   . | . | .   .
. |  .   .   .   .   . | . | .   . | . |
. |  .   .   .   .   . | . | .   . | . | .
4 | 11   .   9   .   7 | . | 5   . | 3 | .  | 1 |
. |  .   .   .   .   . | . | .   . | . | .  | . | .
. |  .   .   .   .   . | . | .   . | . | .  | . | .   .
. |  .   .   .   .   . | . | .   . | . | .  | . | .   .   .
|____________________|___|_______|___|____|___|_____________
(1) (2) (3) (4) (5)| 6 |(7) (8)| 9 |(10)| 11|(12)(13)(14)

C 

Three possibilities remain for A,B,C and I  haven’t figured out didn’t understand how any of them may be further eliminated.

       . |  .
- |  .   -
- |  -   .   -
- |  .   -   .   -     A = 1, B = 9, C = 6
. |  .   .   .   .   .    /
9 |  .   -   .   -   . | 1 |
- |  -   .   -   .   - | . | -       A = 3, B = 4, C = 9
B    . |  .   .   .   .   . | . | .   .      /
. |  .   .   .   .   . | . | .   . | . /   A = 1, B = 4, C = 11
. |  .   .   .   .   . | . | .   . | ./| .    /
4 |  -   .   -   .   - | . | -   . | 3 | . | 1 |
. |  .   .   .   .   . | . | .   . | . | . | . | .
. |  .   .   .   .   . | . | .   . | . | . | . | .   .
. |  .   .   .   .   . | . | .   . | . | . | . | .   .   .
|____________________|___|_______|___|___|___|____________
-   -   -   -   - | 6 | -   - | 9 | - | 11| -   -   -

C 

New conclusion

Then came the comment by bipll elsewhere:

If student #2 has 9, it knows all the numbers are different before student #1’s answer. – bipll

Here is the second student’s statement again, noting the word “now.”

• After hearing that, the second (B) says now he knows everyone has different numbers.

This can be taken to mean that the second student did not already know that A ≠ B ≠ C before hearing the first student’s statement. Three more rows of B on the original layout may be eliminated because all entries on those rows have A ≠ B ≠ C, in which case B would have known as much from the start. These rows are highlighted with yet more ( ) parentheses. All entries are also shown, unadorned, where A = B, A = C or B = C to demonstrate that every other row has at least one such entry.

      14 |  1
13 | (2) (1)
12 |      2
11 | (4) (3) (2) (1)
10 |          3                   A
9 | (6) (5) (4) (3) (2) (1)
8 |              4
B    7 |      7                   2
6 |              6   5   4
5 |                  6   5
4 |              8       6       4
3 |         10                           3
2 |     12                   7                   2
1 | 14                                                   1
|_________________________________________________________
1   2   3   4   5   6   7   8   9   10  11  12  13  14

C


This does reduce the possibilities for A,B,C to just two, of which I haven’t figured out, or been told, how the third student (C) could distinguish just one. (Reinterpreting “now” in that student's statement doesn’t seem to help.)

       . |  .
. | (.) (.)
. |  .   .   .
. | (.) (.) (.) (.)
. |  .   .   .   .   .
- | (.) (.) (.) (.) (.) (-)
. |  .   .   .   .   .   .   .       A = 3, B = 4, C = 9
B    . |  .   .   .   .   .   .   .   .      /
. |  .   .   .   .   .   .   .   . | . /   A = 1, B = 4, C = 11
. |  .   .   .   .   .   .   .   . | ./| .    /
4 |  .   .   .   .   .   .   .   . | 3 | . | 1 |
. |  .   .   .   .   .   .   .   . | . | . | . | .
. |  .   .   .   .   .   .   .   . | . | . | . | .   .
. |  .   .   .   .   .   .   .   . | . | . | . | .   .   .
|________________________________|___|___|___|____________
.   .   .   .   .   -   .   . | 9 | . | 11| .   .   .

C 

• This is a really nice way of visualising the other 2 answers and also showing that (i) no unique solution exists, and (ii) no other solution exists... +1
– Stiv
Jun 26, 2020 at 11:48
• Looks like we're back to just your original double-solution, @Stiv , wow
– humn
Jun 26, 2020 at 17:30

The first student says he knows that the two other students have different numbers.

From this statement, we can infer that the first student must have

an odd number: 1, 3, 5, 7, 9, 11, 13

After hearing that the second says now he knows everyone has different numbers.

Either:
- the second student has an odd number > 7 (to not match the first student's odd number): 9, 11, 13.
- the second student has an even number (y) that satisfies 16 = y + 2x for some even x = 2w (16 = y + 4w): 12, 8, 4

This gives us the second student's complete list of possibilities:

4, 8, 9, 11, 12, 13

After hearing the statement of the second student the third says that now he knows everyone's number.

Third player: [first player, second player]

1: [3, 12], [7, 8], [11, 4]
2: [3, 11], [5, 9]
3: [1, 12], [5, 8], [9, 4]
4: [1, 11], [3, 9]
5: [3, 8], [7, 4]
6: [1, 9]
7: [1, 8], [5, 4]
8: --- no solution
9: [3, 4]
10: --- no solution
11: [1, 4]
12: --- no solution
13: --- no solution
14: --- no solution

In order for the third player to be able to deduce the complete set, they must have had

6, 9, or 11:
[1, 9, 6]
[3, 4, 9]
[1, 4, 11]

• One of your 3 solutions has been discussed in comments on QuantumTwinkie's answer and bipll showed it couldn't hold logically...
– Stiv
Jun 26, 2020 at 18:52
• @Stiv I disagree. The statement made by the second player is not strong enough to indicate that he did not know previously. If the sentence is intended to emphasize "Now I know that ...", then it should have been written that way. As it is, it could be equally grammatically correct to interpret it (with a rearrangement to clarify my point): "The second player now says: ...", which is more indicative of the second player simply waiting his turn to speak. Jun 26, 2020 at 18:58