Five Sages
Here is a new puzzle by Nikolai Chernyatiev.
Puzzle. Five sages, who all know one another, are blindfolded, seated in a row in a dimly lit hall, and then have their blindfolds removed. Each sage can see both of their immediate neighbors, but no farther; the sages at the ends know that they are at the ends. After that, each sage writes down one of the numbers 1, 2, or 3. The complete information — who wrote which number, in seating order — is then announced to everyone.
Before being seated, the sages may agree on a rule for choosing 1, 2, or 3 based on what they see. After the five numbers are announced, each sage must reconstruct the full left-to-right order of all five sages.
I love puzzles related to information theory, and this is a lovely example. Let’s do a quick sanity check. There are 5! = 120 possible orders of the sages. The announced numbers form a ternary string of length 5, giving 35 = 243 possible announcements. That is more than enough in principle; so far, so good.
AI can produce a possible table of answers, but the resulting strategy is not very inspiring. Fortunately, there is a much more elegant solution based on the following neat fact:
Among any three distinct residues modulo 5, exactly one is the average of the other two. Equivalently, any three vertices of a regular pentagon form an isosceles triangle: one of the three vertices lies on the axis of symmetry of the other two.
But wait: Konstantin Knop proved a much tighter result. Each sage can get away with writing down only one of two numbers. Wow!
Share:
Sanandan Swaminathan:
Thanks for the interesting puzzles. For the announcement “who wrote which number, in seating order”, I imagine the “who” must mean the seat number. Thanks to the big hint about the regular pentagon, I can see how it can be done using only two numbers 1 and 2. The deciphering by the sages naturally becomes simpler when three numbers are allowed. In either case, the hint about the pentagon (or equivalently, the average of two numbers in a triad, modulo 5) was of immense help.
Assume the names of the sages are A, B, C, D, E. Before the game starts, they orient a pentagon ABCDE with A at the top and the vertices labeled clockwise. For any triad of vertices, we will call the vertex that is on the axis of symmetry of the segment joining the other two vertices as the “middle” of that triad. For example, for ABC, the middle is B. For ABD, the middle is D.
Strategy when each sage can only write down 1 or 2:
If a sage is at either end of the row, he writes 1 if his name is alphabetically smaller than the single sage he sees, otherwise he writes 2. If a sage is not at an end, he considers the triad of sages (left sage, self, right sage). If he himself happens to be the “middle” of the triad, he writes 1, otherwise 2.
The sages in seats 2 and 4 can decipher the whole order of sages trivially. For example, the sage in seat 2 can see the sages in seats 1 and 3, so he knows who the remaining two sages are. Based on the number announced for sage 5, he can order those last two sages also. Same idea with seat 4 as well.
Now consider the sage in seat 1. WLOG, let us say it is sage A, and sitting in seat 2 is sage B. If B’s announced number is 1, sage A (in seat 1) knows that the first three seats are ABC. Using seat 5’s announced number, he can decipher the sages in seats 4 and 5. If B’s announced number is 2, sage A (in seat 1) knows that the first three seats are ABD or ABE (and the remaining two sages corresponding to each case). The order of sages could be one of the following:
1. ABDCE: The announcement would be 12222
2. ABDEC: The announcement would be 12221
3. ABECD: The announcement would be 12122
4. ABEDC: The announcement would be 12211
Sage A would decipher the occupants of the last three seats based on the last three numbers announced (each set different). Symmetrically, the sage in seat 5 can decipher the whole order.
Now consider the sage in seat 3 (the middle seat). WLOG, let us say it is sage A. Consider the seating in seats 2, 3, 4. Ignoring reflections, the possibilities and how the sage in the middle seat deciphers the whole order are given below:
1. BAD: Sage A knows that the corner sages are C and E. If the answers from seats 1 and 5 were 2 and 2, then C is in seat 1 and E is in seat 5. Otherwise, the answers would be 2 and 1, and E would be in seat 1 and C in seat 5.
2. CAD: Sage A knows that the corner sages are B and E. If the answers from seats 1 and 5 were 1 and 2, then B is in seat 1 and E is in seat 5. Otherwise, the answers would be 2 and 1, and E would be in seat 1 and B in seat 5.
3. CAE: Sage A knows that the corner sages are B and D. If the answers from seats 1 and 5 were 1 and 1, then B is in seat 1 and D is in seat 5. Otherwise, the answers would be 2 and 1, and D would be in seat 1 and B in seat 5.
4. BAC: Sage A knows that the corner sages are D and E. In the case, the answers from seats 1 and 5 will be 2 and 2 irrespective of how the duo is seated. However, if D was sitting in seat 1, B would be in the DBA triad, and would have answered 1. If E was sitting in seat 1, B would be in the EBA triad, and would have answered 2. Thus, based on seat 2’s answer, the middle sage A can decipher the whole order.
5. BAE: Sage A knows that the corner sages are C and D. In the case, the answers from seats 1 and 5 will be 2 and 1 irrespective of how the duo is seated. However, if C was sitting in seat 1, B would be in the CBA triad, and would have answered 2. If D was sitting in seat 1, B would be in the DBA triad, and would have answered 1. Thus, based on seat 2’s answer, the middle sage A can decipher the whole order.
6. DAE: Sage A knows that the corner sages are B and C. In the case, the answers from seats 1 and 5 will be 1 and 1 irrespective of how the duo is seated. However, if B was sitting in seat 1, D would be in the BDA triad, and would have answered 1. If C was sitting in seat 1, D would be in the CDA triad, and would have answered 2. Thus, based on seat 2’s answer, the middle sage A can decipher the whole order.
Thus, all five sages can decipher the whole order of sages.
If each sage is allowed to write one of three numbers (1, 2, 3), deciphering becomes simpler. If a sage is at either end of the row, he writes 1 if his name is alphabetically smaller than the sage he sees, otherwise he writes 2. If a sage is not at an end, he considers the triad of sages (left sage, self, right sage). If the left sage is the “middle” of the triad, he writes 1. If he himself is the “middle” of the triad, he writes 2. Otherwise, he writes 3.
The sages in seats 2 and 4 can decipher the whole order of sages trivially (as shown before when sages were constrained to only two numbers).
Now consider the sage in seat 1. WLOG, let us say it is sage A, and sitting in seat 2 is sage B. If the first three seats are ABE, B’s answer would be 1. If ABC, B’s answer would be 2. If ABD, B’s answer would be 3. Based on B’s answer, seat 1 knows who is in the middle seat. He also knows the remaining two sages, and based on seat 5’s answer, he knows their order as well.
Now consider the sage in the middle seat. WLOG, let us say it is sage A, and let us say sage B is sitting in seat 2. If the first three seats are DBA, B’s answer would be 1. If the first three seats are CBA, B’s answer would be 2. If the first three seats are EBA, B’s answer would be 3. Based on B’s answer, seat 3 knows who is in seat 1. Since he can see who is in seat 4, the remaining sage is in seat 5.
In either of the two puzzles, if the sages wished to use the average mod 5 idea, then they could number themselves 0 through 4. For each subset of three sages numbers, as stated, exactly one of the numbers is the average of the other two, mod 5. These triad/average pairs are… 012: 1, 013: 3, 014:0, 023: 0, 024: 2, 034: 4, 123: 2, 124: 4, 134: 1, and 234: 3. The end sages can still signal based on whether their number is smaller than the neighbor’s. The other sages would consider whether their number is the average of the triad they are in (mod 5). Instead of writing their number based on “middle of triad in the regular pentagon”, they would base it on “who is the average of the other two in the triad”.
18 June 2026, 7:07 pmPeter Sparlinek:
The problem description states that the sages at the ends know that they are at the ends.
I assume for a sage it is clear whether it is position 1 or position 5 from the kind of how you are sitting. Correct ?
However a sage at seat 2, 3 or 4 does not know his seat number.
Therefore I have a problem with the argument For example, the sage in seat 2 can see the sages in seats 1 and 3, so he knows who the remaining two sages are. Based on the number announced for sage 5, he can order those last two sages also. Same idea with seat 4 as well.
In my opinion the sage at seat 2 cannot assume to know the sages in seat 1 and 3, because it could also be the sages in seats 2 and 4, or 3 and 5, respectively. At least if the digit the sage said is not unique in the set of 5 digits.
Since I am no native English speaker, it could be that I am missing an important point in the problem.
19 June 2026, 7:27 amMaybe someone could explain this issue to me?
Sanandan Swaminathan:
Peter, your interpretation is a valid one. I assumed that all five sages are aware of their seat number (not just the sages in seats 1 and 5), and that the main constraint is that the end seats can see one sage while the middle seats can see two sages (and everyone needs to figure out where the sages whom they cannot see are sitting). Now that you mention it, I’m not sure if even the sage in seat 1 is supposed to know whether he is sitting in seat 1 or seat 5 (and the same issue for the sage in seat 5)!
The problem says that the announcement mentions “who wrote which number, in seating order.” The goal mentioned is that the sages must reconstruct the seating in “left-to-right order.” Perhaps Tanya will clarify the game setup.
19 June 2026, 2:57 pmKonstantin Knop:
The problem assumes that no one except those standing at the ends knows their position (and must determine it, among other things). It also assumes that answers are written in the format “name + number (1 or 2),” not “position number + number.”
21 June 2026, 8:22 amSanandan Swaminathan:
Konstantn, thanks for the clarification. I still have a few questions about the setup. Does the announcement (which all the sages can hear) mention the numbers (and only the numbers) in left-to-right seating order (left-to-right from the perspective of the seated sages)? Are all five sages seated with the same orientation? If so, then the leftmost sage knows that he is “leftmost” (and not rightmost), and the rightmost sage knows that he is “rightmost” (and not leftmost)? Does each of the three middle sages know that the announced numbers start from somewhere on his left?
22 June 2026, 1:24 pm