Skip to content
User Avatar
#920
Auto-translated
I tried to derive a formula based on the difference between the number of hats of different colors, but I couldn't. So, I'll write it down; maybe it will give someone an idea.
The idea was to come up with a color for each value of the function of the differences (the problem is with the function itself), which the first person to answer would name.
For example, if the value is 0, it's green; if it's 1, it's red; if it's 2, it's blue; if it's 3, it's green again... In general, as an option, N (where N is a natural number and 0) means green, N+1 means red, and N+2 means blue.

As for the function itself, I tried adding all 3 differences (taking the absolute value of the difference, of course), as well as any 2 of them. Something doesn't work.
That is, I had this: let's say there were 36 red hats, 32 blue, and 31 green in front of the first person to answer.
He adds, for example, all 3 differences: 4+5+1. He gets 10. 10 is the color of the hat, and he names it.
The second person counts the hats in front of him (and he heard "red," so he understands that the sum of the differences in front of the last person was 1, 4, 7, 10, 13...
He counts the differences in front of him (let's say he has a red hat, but he doesn't know it. Then there should be 35 red, 32 blue, 31 green. The sum of the differences is 8.
He figures that the difference couldn't have changed much because his hat wasn't taken into account; for the first person, it was 7 or 10.
Then, if I have a green hat, the second person thinks, the first person would have: 3+3+0. That doesn't work.
If I have a blue hat, he would have: 2+2+4=8. That doesn't work.
With a red hat, it obviously works.
But now let's consider another case, if the second person actually has a blue hat.
Then he figures (he sees 36 red, 31 blue, 31 green): the difference is 10.
And then it turns out that a red hat doesn't suit him (because then the difference would be 12 for the first person, but that's not red, it's green).
But he can't choose between blue and green because the difference turns out to be the same because they are now equal.

In the first case, the third wise man would probably be able to calculate his difference and compare it with the answers of the first and second. But again, in the case of a tie, he falls asleep.
I tried to modify the formula, but I didn't succeed.

For example, if there were 2 colors of hats, only blue and red, it would be easier. There are a total of 99 hats in front of the first person. Let's say 51 are red and 48 are blue. And agree in advance that if the number of red hats is even, you name the color red; if it's odd, you name the color blue. So, he names blue.
The second person looks (let's say he has a red hat). In front of him, there are 50 red and 48 blue. And the first person said that there was an odd number of red hats in front of him. Therefore, seeing an even number of red hats, the second person understands that he has a red hat.
Similarly, if he had a blue hat, the number of red hats would still be odd, and the second person would understand this.
The third person reasons in the same way: there was an odd number of red hats in front of the first person, and the second person named red. Therefore, if the third person has a red hat, the number of red hats in front of him is odd; if he has a blue hat, it's even.
But I can't figure out how to apply a similar formula for three colors.

For example, you can look at the divisibility by certain numbers or the divisibility between the differences, but I can't derive a formula, although it probably exists.

There was another idea: to calculate the sum of the hats with coefficients: 1*number of red + 2*number of blue + 3*number of green. (with the same principle - the sum is divisible by three - the first person names green, divisible by three + 1 red, three + 2 blue). And the second person counts his sum and compares it, but something went wrong again.