# 23 people wearing hats with a bell ringing [closed]

24 extremely intelligent people get invited to a really important party. Since it's really important after 9pm (the start time of the party) a guardian will guard the door to enter the party. All of the other 23 people arrive successfully at the party, but you get late and you encounter the guardian.

He says: "Imagine if I gave 23 hats of random colors to the 23 people in the party. I put them in a circle, so they can see the colors of the hats of all of the other people, but not the color of the hat they are wearing. They are not allowed to speak or communicate and they don't know how many hats of the same color exist, or how many different hat colors exist.

I told them that I gave the hats in a way where even by switching position in the circle randomly they still had a way to win.

Every 2 minutes a bell rings and who wants can come to me and tell me the color of their own hat. If 1 single person of the 23 people fail to tell their color they lose.

On the first bell ring 4 people come to me and guess the color correctly.
On the second bell 3 people come to me and all guess the color "red", which is correct.
On the third bell 0 people come to me.
On the fifth bell ring some people come to me and guess correctly their color.
On the sixth bell ring all of the remaining people come to me and manage to guess correctly.

If you can tell me how many people went out on the fourth bell ring I will let you in the party."

• What is the source of this puzzle? Mar 7, 2022 at 22:17
• what do u mean? Mar 7, 2022 at 23:31
• I think you can leave out the lines about the fourth and fifth bells, looks like the solution is still unique even without them. (Either that, or my brain is misfiring and I am seeing things.)
– Bass
Mar 8, 2022 at 1:46
• @TechnicalGaming I mean, where did you find this puzzle? Your original title was "need help solving riddle", so presumably you didn't write this puzzle yourself? Mar 8, 2022 at 5:17
• So where did you find this puzzle? Mar 8, 2022 at 9:39

The key is the phrase

"I told them that I gave the hats in a way [..] they still had a way to win."

Obviously, if there ever is a colour with only one hat, it will be impossible for that hat's wearer to guess the colour, so there are at least two hats of each colour, and everyone can deduce that.

The 4 people guessing correctly at the first bell, therefore, will be the ones that see a single hat of some colour, and there were two colours with two hats.

People left: 19

At the second bell, the colours that had only 2 hats have been eliminated, and everyone can see which colours those were. So the ones reporting in are the ones that still at this point see a colour with only two hats. (The only colour with three hats turns out to have been red.)

People left: 16

Now we suspiciously skip any information about the third bell. Hmmm. Sneaky sneaky. No information about colours with 4 hats then.

People still left: 16 (minus a multiple of 4).

At the fourth bell we get to know there were no colours with 5 hats.

People still left: 16 (minus a multiple of 4).

At the fifth bell, there are still at least two hat colours left, because the game continues into bell 6. The groups (if any) that guess correctly at this bell are of size 6.

At the 6th bell everyone guesses correctly, so there are two possibilities:

• there were two colours of exactly 7 hats, in which case there cannot have been any correct guesses on bell 5, or
• there was exactly one colour left (of size 7 or more), in which case there must have been at least (and at most) one correctly guessing group of 6 people at bell 5.

The first option turns out to be impossible (if 14 people of the remaining 16 guessed right at the sixth bell, what happened to the other 2? The groups guessing right on bell 3, if any, would have been of size 4).

So the second option must be correct, and therefore

6 people

guessed right on the fifth bell.

(From this, we can further deduce that the most popular hat colour had 10 people wearing it.)

• The question was edited after your answer. I don't think it's a good idea to change the question after someone answered, but if you think the answer doesn't change much, I think you can just change it this time. Mar 8, 2022 at 8:37
• The question edit doesn't change anything, really; the lines about bells 3, 4 and 5 are all unnecessary in the first place, as they can all be uniquely deduced from the information known about bells 1, 2 and 6. So I think I'll leave the answer as it is. (At least until I find the motivation to do a "master edit", turning the entire logic around to make it easier to follow)
– Bass
Mar 8, 2022 at 10:00
• The first deduction feels a little bit weird to me, a bit like using uniqueness when solving a Sudoku. Assuming a Sudoku solution is unique allows you to deduce what it would have to be. And in this puzzle the assertion that there is a way to win allows you to deduce what it would have to be. Assuming sudoku solution uniqueness can never then establish the solution is unique, and in this puzzle assuming there is a way for the people to win cannot ever establish that there really is a way to win. But the guardian simply asserts it, thereby bringing it into existence. It seems very odd to me. Mar 8, 2022 at 13:06
• @justhalf Imagine there were only 2 players, you are one of them. The guardian asserts that you can deduce your hat's colour from the colour of the other player's hat. You then say: So my hat must be the same colour as theirs, because all other colours are equivalent and I wouldn't be able to choose between them. Don't you think that is weird? How about the complementary colour of the other person's hat? To me the guardian's statement is a logical falsehood, and by assuming it is true anything can be proven true (whether by the player in the puzzle or you as the puzzle solver). Mar 9, 2022 at 8:34
• I agree with @JaapScherphuis. To me "still had a way to win" is so ambiguous as to be meaningless. It's not a logical statement that can be used to make deductions. For example, in the 2-player case, as JaapScherphuis points out, there are other reasonable ways to pick a color based on seeing another one (taking the complementary color). But they always "have a way to win" by correctly guessing. If we interpret the statement as "have a way to win with pure logic," it does seem a falsehood. Maybe if the guests were incapable of naming colors they couldn't see, it would begin to make sense....? Mar 9, 2022 at 16:09