|
The king of some faraway land is bored, so he decides to setup a little game for his own amusement. These are the rules of the game:
7 prisoners will be seated at a round table. Each prisoner will have a hat placed on their head. Each hat is one of seven possible colors. The prisoners can see everyone else's hat, but they cannot see their own. The prisoners will then write on a piece of paper what they think their hat color is, and hand the paper to the king.
If any of the prisoners guesses their hat color correctly, they will all go free. Otherwise, they are all executed on the spot.
If the prisoners use the naive strategy of guessing randomly, then they have a survival chance of 66%. Can you think of a strategy such that the prisoners have a 100% chance of survival?
Clarification: 1) There are no restrictions on how many of each color there are. The prisoners could all be wearing hats of the same color, or they could also all be wearing hats of different colors. 2) The prisoners cannot communicate in any way to each other after being seated on the table. 3) You know which 7 colors are in the pool of possible colors.
Edit: Karlsberg posted an almost right solution, which prompted me to post the actual solution.
+ Show Spoiler [solution] + We assign each color a number from 0-6
Now we can say that the prisoners are essentially getting a number, c0,c1,c2,c3,c4,c5,c6.
S = (c0 + c1 + c2 + c3 + c4 + c5 + c6) modulo 7
S has seven possible values, 0-6
At this point, what each prisoner is doing is trying to guess what S is, and solving for their own number to match S.
Prisoner 0 assumes S = 0, and solves the equation c0 = S - (c1+c2+c3+c4+c5+c6) Prisoner 1 assumes S = 1, and solves the equation c1 = S - (c0+c2+c3+c4+c5+c6) and so on..
At least one of the 7 prisoners will assume the correct S value. That prisoner will be able to guess the correct number for their own hat.
   
|
I believe you forgot the important rule that states no prisoners can communicate in whichever way with one another.
Otherwise, the game would end readily after a few questions are asked.
I will try to think of a solution without communicating.
|
1.Look at everyones hat, pass it around. So then you can look at other people's hats(aka, no longer your hat)
2.Say white, because that's the combination of all colors.
3.Say "Brow...*look at their reaction* I MEAN... gree...*look at their reaction. Finds approval.* Green
4.Technically, if you try to find a loophole, its just a random hat placed on their head. So they are not allowed to look at there OWN hat, by its not their hat. It's the king or someones. So they can just take it off and look at it.
|
i have a feeling that the answer isn't going to be one that'll make me go "OH THATS SMART" but rather "oh... -_-"
|
you may have mixed up two different puzzles into one combo puzzle that doesn't make sense.
|
this is tricky. let's look at the two extreme situations:
1) all the same color. to win in this situation, your strategy must select a color inside of the colors you see on other people's heads. 2) all different colors. to win in this situation, your strategy must select a color outside of the colors you see on other people's heads.
so your strategy is going to have to be a function of the distribution of colors you see.
|
Are they allowed to agree on a timing system beforehand?
|
On September 10 2010 05:54 Nytefish wrote: Are they allowed to agree on a timing system beforehand? that won't help considering they don't even know what colors are in the pool of hats except whats in front of them. the classic puzzle i know of only involves n colors, and 2n people, in which case a timing system works.
|
Taking out all possible forms of loopholes, how can a 100% survival rate be achieved since they all could guess incorrectly.
|
On September 10 2010 05:53 AcrossFiveJulys wrote: this is tricky. let's look at the two extreme situations:
1) all the same color. to win in this situation, your strategy must select a color inside of the colors you see on other people's heads. 2) all different colors. to win in this situation, your strategy must select a color outside of the colors you see on other people's heads.
so your strategy is going to have to be a function of the distribution of colors you see.
I am bad at math but I doubt this will hit the 100% required.
I am guessing that the answer will be arrived at through a logical leap instead of math.
Question: Do they know what colors are available?
|
On September 10 2010 05:57 seRapH wrote:Show nested quote +On September 10 2010 05:54 Nytefish wrote: Are they allowed to agree on a timing system beforehand? that won't help considering they don't even know what colors are in the pool of hats except whats in front of them. the classic puzzle i know of only involves n colors, and 2n people, in which case a timing system works.
i think they know the colors in the pool, otherwise in the example i brought up there's no way to win 100% when all colors are different.
|
Hungary11284 Posts
I wonder how the prisoners have a chance of 66% by guessing randomly. If they pick 1 / 7 (given they know the seven available colors), they have a 14% chance of getting it right. Doing it 7 times is 100%, so statistically one should get it right.
Or am I missing something?
|
On September 10 2010 05:58 LunarDestiny wrote: Taking out all possible forms of loopholes, how can a 100% survival rate be achieved since they all could guess incorrectly. It can't. There must be a "logical trick" based on lack of information.
If the problem is "your hat could be any of 7 colours regardles of what you see, guess what it is out of 7 colours" you could play this game a million times and never guess right.
So the "trick" must allow prisoners to pass some form of information to each other.
|
I have updated the post with clarifications.
@tissue: They know the 7 possible colors
|
On September 10 2010 06:05 Aesop wrote: I wonder how the prisoners have a chance of 66% by guessing randomly. If they pick 1 / 7 (given they know the seven available colors), they have a 14% chance of getting it right. Doing it 7 times is 100%, so statistically one should get it right.
Or am I missing something? In case you aren't trolling it's 1 - 6/7 ^ 7 I believe, which comes to almost exactly 66%. Flipping a coin is 50/50. Doing it twice doesn't mean you will have a confirmed heads or tails.
|
On September 10 2010 06:05 Aesop wrote: I wonder how the prisoners have a chance of 66% by guessing randomly. If they pick 1 / 7 (given they know the seven available colors), they have a 14% chance of getting it right. Doing it 7 times is 100%, so statistically one should get it right.
Or am I missing something?
that's a common misconception about probability. Here's a hint as to why that's not right. If they each had 2 chances, do you think they have a 14*14 = 196% chance of winning?
|
Hello!
lurked at this site for some time and couldn't resist EDIT but didn't have the solution... EDIT
|
On September 10 2010 06:02 AcrossFiveJulys wrote:Show nested quote +On September 10 2010 05:57 seRapH wrote:On September 10 2010 05:54 Nytefish wrote: Are they allowed to agree on a timing system beforehand? that won't help considering they don't even know what colors are in the pool of hats except whats in front of them. the classic puzzle i know of only involves n colors, and 2n people, in which case a timing system works. i think they know the colors in the pool, otherwise in the example i brought up there's no way to win 100% when all colors are different. even then its mathematically impossible to have a 100% correct rate PER PERSON. your hat color is not affected by anyone else's.
the only solution i can think of is if the prisoners get to talk beforehand:
The first person will write a color of a hat he sees, show it to everyone, and give it to the king. everyone else writes that same color. but this involves a form of communication, and so feels gimmicky
|
On September 10 2010 06:05 Aesop wrote: I wonder how the prisoners have a chance of 66% by guessing randomly. If they pick 1 / 7 (given they know the seven available colors), they have a 14% chance of getting it right. Doing it 7 times is 100%, so statistically one should get it right.
Or am I missing something?
What you just calculated is the expected number of correct guesses if they all guess randomly. They only need one correct guess, and sometimes they can all guess wrong.
The correct way to calculate their chance of survival is like this:
Each prisoner has 1/7 of getting it right, which means 6/7 chance of getting it wrong.
The probability that all prisoners are wrong is (6/7)^7.
The probability that at least one gets it right is 1 - (6/7)^7 = .66
|
On September 10 2010 06:05 Aesop wrote: I wonder how the prisoners have a chance of 66% by guessing randomly. If they pick 1 / 7 (given they know the seven available colors), they have a 14% chance of getting it right. Doing it 7 times is 100%, so statistically one should get it right.
Or am I missing something? Not quite..... If the first one guesses correctly (which is a 1/7 chance), then the game is over.
If not, then the chance that the second one will guess correctly is 6/7 (chance of the first one being wrong) * 1/7 (chance of the 2nd one guessing correctly).
If the 2nd one does not get it, then the 3rd has the chance of (6/7)^2 * 1/7
The 4th then has the chance of (6/7)^3 * 1/7
etcetera.....
The chance that at least one gets it is the sum of these percentages. Which, no matter how many people there are, will never actually be 100%.
|
On September 10 2010 06:07 0nega wrote: Hello!
lurked at this site for some time and couldn't resist EDIT but didn't have the solution... EDIT
+ Show Spoiler +i don't think they get to pick which hat they take. the hats are placed on the prisoners' heads
|
Hungary11284 Posts
kk, I get it, thanks for the explanations.
|
On September 10 2010 06:05 Aesop wrote: I wonder how the prisoners have a chance of 66% by guessing randomly. If they pick 1 / 7 (given they know the seven available colors), they have a 14% chance of getting it right. Doing it 7 times is 100%, so statistically one should get it right.
Or am I missing something? If there were 6 prisoners who had to roll a die and guess the number they were going to get beforehand, each one would have a 1/6 chance of getting it right. Doing it 6 times does not mean one of them is going to get it right. Same thing with guessing the color of a hat with 1/7 chance, since the OP specifies that the hats could be the same color.
|
I wish I had a zero knowledge proof to show that this problem is possible, but I'll just wait until someone finds the solution.
|
On September 10 2010 06:07 0nega wrote:Hello! lurked at this site for some time and couldn't resist to post the solution(hopefully) + Show Spoiler +Before they get the hats, they agree, that they will all take the colour of the hat of one guy, this guy instead takes the colour which no hat he sees has hmm... Situation XXX: Hat color is ROY G BLV TEH guys is red. Other dudes are ROY G BL.
The other dudes picks red->got owned. TEH guys picks V-->>got owned.
|
On September 10 2010 06:08 seRapH wrote:Show nested quote +On September 10 2010 06:02 AcrossFiveJulys wrote:On September 10 2010 05:57 seRapH wrote:On September 10 2010 05:54 Nytefish wrote: Are they allowed to agree on a timing system beforehand? that won't help considering they don't even know what colors are in the pool of hats except whats in front of them. the classic puzzle i know of only involves n colors, and 2n people, in which case a timing system works. i think they know the colors in the pool, otherwise in the example i brought up there's no way to win 100% when all colors are different. even then its mathematically impossible to have a 100% correct rate PER PERSON. your hat color is not affected by anyone else's. the only solution i can think of is if the prisoners get to talk beforehand: The first person will write a color of a hat he sees, show it to everyone, and give it to the king. everyone else writes that same color. but this involves a form of communication, and so feels gimmicky 
OP states that they cannot communicate AFTER they are seated. meaning they can come up with strategy beforehand. secondly, the sheets are directly handed to the king without possibility being shown to others
@OP
my solution is for seven people to agree on all looking at one color hat, say white or black, if someone is already looking at a white hat, look at another white hat. if there are no white hats, look at the table
say each person is labeled A,B,C,D,E,F,G person A is responsible to look at person B's hat, person B for C, and so on
if person A sees that person B is looking at his hat, A knows he's wearing a white hat, vice versa.
|
On September 10 2010 06:02 AcrossFiveJulys wrote:i think they know the colors in the pool, otherwise in the example i brought up there's no way to win 100% when all colors are different. I agree.
This is complicated though: Image you see a 2:4 distribution of colors, you might have a completely different color (so 5 possibilities) but if you try to guess, you'll need to be sure that if your guess fails someone else's guess must be right. You could also be on the 2 team (making it 3:4) or on the 4 team (so 2:5) If you're in 3:4 then 4 players will see a 3:3 and 2 other players will see a 2:4 like you did. If you're in 2:5 then 2 players will see a 1:5 and 4 other players will see a 2:4 like you did. Oh and if it's 1:2:4, then 2 players will see 1:1:5 and 4 will see 1:2:3.
This will get really complicated.
Edit: *this was answered in the OP's edit* Can we have different rules for the different players? Like player 1 will side with the 'color 1 team' and player 2 will side with the 'color 2 team' if they see a 2:4??
|
2) The prisoners cannot communicate in any way to each other after being seated on the table.
So then, before they sit down and get the hats, they are able to communicate, right? If so, here is my answer:
+ Show Spoiler +Before sitting down on the table and getting the hats, the prisoners agree to write down the color of the hat of the person sitting clockwise to them once they sit down and get the hats. Afterwards, they all pass their papers clockwise by one person and turn in the answers.
Do I get a cookie now?
|
On September 10 2010 06:14 saltywet wrote:Show nested quote +On September 10 2010 06:08 seRapH wrote:On September 10 2010 06:02 AcrossFiveJulys wrote:On September 10 2010 05:57 seRapH wrote:On September 10 2010 05:54 Nytefish wrote: Are they allowed to agree on a timing system beforehand? that won't help considering they don't even know what colors are in the pool of hats except whats in front of them. the classic puzzle i know of only involves n colors, and 2n people, in which case a timing system works. i think they know the colors in the pool, otherwise in the example i brought up there's no way to win 100% when all colors are different. even then its mathematically impossible to have a 100% correct rate PER PERSON. your hat color is not affected by anyone else's. the only solution i can think of is if the prisoners get to talk beforehand: The first person will write a color of a hat he sees, show it to everyone, and give it to the king. everyone else writes that same color. but this involves a form of communication, and so feels gimmicky  OP states that they cannot communicate AFTER they are seated. meaning they can come up with strategy beforehand. secondly, the sheets are directly handed to the king without possibility being shown to others @OP my solution is for seven people to agree on all looking at one color hat, say white or black, if someone is already looking at a white hat, look at another white hat. if there are no white hats, look at the table say each person is labeled A,B,C,D,E,F,G person A is responsible to look at person B's hat, person B for C, and so on if person A sees that person B is looking at his hat, A knows he's wearing a white hat, vice versa.
On September 10 2010 06:14 The_Pacifist wrote:Show nested quote +2) The prisoners cannot communicate in any way to each other after being seated on the table. So then, before they sit down and get the hats, they are able to communicate, right? If so, here is my answer: + Show Spoiler +Before sitting down on the table and getting the hats, the prisoners agree to write down the color of the hat of the person sitting clockwise to them once they sit down and get the hats. Afterwards, they all pass their papers clockwise by one person and turn in the answers. Do I get a cookie now?
These both use communication after the hats are passed out, therefore should not be valid solutions.
|
On September 10 2010 06:14 saltywet wrote:Show nested quote +On September 10 2010 06:08 seRapH wrote:On September 10 2010 06:02 AcrossFiveJulys wrote:On September 10 2010 05:57 seRapH wrote:On September 10 2010 05:54 Nytefish wrote: Are they allowed to agree on a timing system beforehand? that won't help considering they don't even know what colors are in the pool of hats except whats in front of them. the classic puzzle i know of only involves n colors, and 2n people, in which case a timing system works. i think they know the colors in the pool, otherwise in the example i brought up there's no way to win 100% when all colors are different. even then its mathematically impossible to have a 100% correct rate PER PERSON. your hat color is not affected by anyone else's. the only solution i can think of is if the prisoners get to talk beforehand: The first person will write a color of a hat he sees, show it to everyone, and give it to the king. everyone else writes that same color. but this involves a form of communication, and so feels gimmicky  OP states that they cannot communicate AFTER they are seated. meaning they can come up with strategy beforehand. secondly, the sheets are directly handed to the king without possibility being shown to others @OP my solution is for seven people to agree on all looking at one color hat, say white or black, if someone is already looking at a white hat, look at another white hat. if there are no white hats, look at the table say each person is labeled A,B,C,D,E,F,G person A is responsible to look at person B's hat, person B for C, and so on if person A sees that person B is looking at his hat, A knows he's wearing a white hat, vice versa.
Observing the direction that people look is a form of communication, and is not allowed. The prisoners can only see the hats for some reason.
|
I think that the answer is probably a gimmick, and that no player can see another person's paper.
If you could see another person's paper, answer is: + Show Spoiler +First guy writes down a color he sees. Everyone copies it. and it seems an injustice to even assume such a horrible answer.
|
On September 10 2010 06:13 LunarDestiny wrote:Show nested quote +On September 10 2010 06:07 0nega wrote:Hello! lurked at this site for some time and couldn't resist to post the solution(hopefully) + Show Spoiler +Before they get the hats, they agree, that they will all take the colour of the hat of one guy, this guy instead takes the colour which no hat he sees has hmm... Situation XXX: Hat color is ROY G BLV TEH guys is red. Other dudes are ROY G BL. The other dudes picks red->got owned. TEH guys picks V-->>got owned.
you fail.
only one guy has to get it right.
Situation XXX: hat colors are ROY G BIV(perhaps there's a reason you used L for Indigo, but I don't know it). the one guys is Red. Other guys are ROY G BI. They choose red, R gets it right. First guy doesn't even have to bother answering.
EDIT. in the case that he is Violet instead(since that was the one missing from your prior example) and when they guess his they get it wrong, by choosing the one that isn't there (V) he gets it right.
|
On September 10 2010 06:18 AcrossFiveJulys wrote:Show nested quote +On September 10 2010 06:14 saltywet wrote:On September 10 2010 06:08 seRapH wrote:On September 10 2010 06:02 AcrossFiveJulys wrote:On September 10 2010 05:57 seRapH wrote:On September 10 2010 05:54 Nytefish wrote: Are they allowed to agree on a timing system beforehand? that won't help considering they don't even know what colors are in the pool of hats except whats in front of them. the classic puzzle i know of only involves n colors, and 2n people, in which case a timing system works. i think they know the colors in the pool, otherwise in the example i brought up there's no way to win 100% when all colors are different. even then its mathematically impossible to have a 100% correct rate PER PERSON. your hat color is not affected by anyone else's. the only solution i can think of is if the prisoners get to talk beforehand: The first person will write a color of a hat he sees, show it to everyone, and give it to the king. everyone else writes that same color. but this involves a form of communication, and so feels gimmicky  OP states that they cannot communicate AFTER they are seated. meaning they can come up with strategy beforehand. secondly, the sheets are directly handed to the king without possibility being shown to others @OP my solution is for seven people to agree on all looking at one color hat, say white or black, if someone is already looking at a white hat, look at another white hat. if there are no white hats, look at the table say each person is labeled A,B,C,D,E,F,G person A is responsible to look at person B's hat, person B for C, and so on if person A sees that person B is looking at his hat, A knows he's wearing a white hat, vice versa. Show nested quote +On September 10 2010 06:14 The_Pacifist wrote:2) The prisoners cannot communicate in any way to each other after being seated on the table. So then, before they sit down and get the hats, they are able to communicate, right? If so, here is my answer: + Show Spoiler +Before sitting down on the table and getting the hats, the prisoners agree to write down the color of the hat of the person sitting clockwise to them once they sit down and get the hats. Afterwards, they all pass their papers clockwise by one person and turn in the answers. Do I get a cookie now? These both use communication after the hats are passed out, therefore should not be valid solutions. This but the problem is impossible otherwise. As I said before there must be a trick so these answers are just as valid as the "real" answer.
|
On September 10 2010 06:19 tissue wrote:I think that the answer is probably a gimmick, and that no player can see another person's paper. If you could see another person's paper, answer is: + Show Spoiler +First guy writes down a color he sees. Everyone copies it. and it seems an injustice to even assume such a horrible answer.
The answer is not a gimmick, it is a math-type problem.
|
The prisoners certainly get to talk beforehand and setup a strategy but they can't show it to other prisoners.
|
a question for the realism of this puzzle: do the prisoners know the number of possible colors while they still can talk and discuss their strategy, ie before they are seated at the table?
so do they know that there are as many colors possible as there are prisoners?
|
Everyone writes the same color?
|
AcrossFiveJulys believes my answer is invalid and uses communication, so I came up with option two:
+ Show Spoiler +Prisoners meet and introduce themselves before getting the hats and sitting at the table. One person introduces himself as "Bob," and all the prisoners agree to write down the color of Bob's hat, whatever it happens to be, once they all sit down and get hats.
Cookie nao? :3
EDIT: Aww, crap. 0nega beat me, and I didn't notice. My bad. In that case, I'll go with 0nega's answer.
|
On September 10 2010 06:07 0nega wrote:Hello! lurked at this site for some time and couldn't resist to post the solution(hopefully) + Show Spoiler +Before they get the hats, they agree, that they will all take the colour of the hat of one guy, this guy instead takes the colour which no hat he sees has
I think this is the solution. If all the hats are a different color the chosen guy gets it right, if there are repeats then the other guy wearing the same color as the chosen guy gets it. Well done.
|
Here's my best guess at an answer. It works but you may or may not argue that it involves communication.
+ Show Spoiler +All the prisoners before hand pick one guy. The six other players agree that if the designated prisoner is wearing a certain colored hat, one of them will begin write that hat color down on their paper (so one of the players will begin to write if the designated one is wearing a red hat, another will begin to write if he is wearing an orange hat, etc). The designated prisoner, seeing the person who is writing, will then know his hat color. If none of the prisoners are writing down anything, then his hat is the seventh color. He writes down his hat color and everyone goes free
|
On September 10 2010 06:27 The_Pacifist wrote:AcrossFiveJulys believes my answer is invalid and uses communication, so I came up with option two: + Show Spoiler +Prisoners meet and introduce themselves before getting the hats and sitting at the table. One person introduces himself as "Bob," and all the prisoners agree to write down the color of Bob's hat, whatever it happens to be, once they all sit down and get hats. Cookie nao? :3 what if bob has color A and all the 6 other prisoners got color B? then this method doesnt work...
|
So why not assume that all the people are completely logical and rational.
Then have one person say a color that he sees. Then the remaining 6 prisoners all say that same color.
Eventually they'll get it right.
*edit* nevermind. They're not saying the colors out loud.
|
Are you sure that you have not left out any rules? Because as it stands right now I can not see a single way that this can be solved since there is NO 100% way of knowing what color your hat has.
Doesn't matter what the other guys are wearing, you could be alone with your hat and still have the exact same chance of calculating the right answer.
Although, if they know the colors beforehand they can simply designate one person to each color so that all seven colors are covered and thereby auto-win. That would be really easy but you said this was a math-problem so...
|
On September 10 2010 06:27 AcrossFiveJulys wrote: I think this is the solution. If all the hats are a different color the chosen guy gets it right, if there are repeats then the other guy wearing the same color as the chosen guy gets it. Well done. unless the repeat does not include the chosen guy ;-)
Bob => red everyone else => blue
1/6 chance for Bob to save the team.
|
On September 10 2010 06:28 Black Gun wrote:Show nested quote +On September 10 2010 06:27 The_Pacifist wrote:AcrossFiveJulys believes my answer is invalid and uses communication, so I came up with option two: + Show Spoiler +Prisoners meet and introduce themselves before getting the hats and sitting at the table. One person introduces himself as "Bob," and all the prisoners agree to write down the color of Bob's hat, whatever it happens to be, once they all sit down and get hats. Cookie nao? :3 what if bob has color A and all the 6 other prisoners got color B? then this method doesnt work...
It doesn't matter. The conditions state that only one person has to get the correct answer. Whether Bob is right or wrong, there is still a 100% chance that all the prisoners will go free, according to the game's rules.
|
On September 10 2010 06:27 AcrossFiveJulys wrote:Show nested quote +On September 10 2010 06:07 0nega wrote:Hello! lurked at this site for some time and couldn't resist to post the solution(hopefully) + Show Spoiler +Before they get the hats, they agree, that they will all take the colour of the hat of one guy, this guy instead takes the colour which no hat he sees has I think this is the solution. If all the hats are a different color the chosen guy gets it right, if there are repeats then the other guy wearing the same color as the chosen guy gets it. Well done. What if his hat is red and every other hat is yellow? They are all going to pick yellow and fail, then he has a 1 in 6 chance of getting it right.
|
Could the OP clarify that no prisoner has access to any information whatsoever other than the color of the hats, and whatever they decided beforehand?
This includes: timing of writing, what other people are writing, etc
|
On September 10 2010 06:30 Seth_ wrote:Show nested quote +On September 10 2010 06:27 AcrossFiveJulys wrote: I think this is the solution. If all the hats are a different color the chosen guy gets it right, if there are repeats then the other guy wearing the same color as the chosen guy gets it. Well done. unless the repeat does not include the chosen guy ;-) Bob => red everyone else => blue 1/7 chance for Bob to save the team.
Ah, that's true. I think we are getting closer though.
|
On September 10 2010 06:28 Stenstyren wrote: Are you sure that you have not left out any rules? Because as it stands right now I can not see a single way that this can be solved since there is NO 100% way of knowing what color your hat has.
Doesn't matter what the other guys are wearing, you could be alone with your hat and still have the exact same chance of calculating the right answer.
Although, if they know the colors beforehand they can simply designate one person to each color so that all seven colors are covered and thereby auto-win. That would be really easy but you said this was a math-problem so...
if everyone tells one color they can still fail. lets denote A the color which prisoner 1 decides to write down, B the color of prisoner 2 and so on. if now the hats are put to the prisoners in the order "1-B,2-C,...,7-A", everyone guesses wrong with this method and their heads are gonna roll...
|
Communication is not allowed, but in what form? Direct or indirect?
Is this allowed? They assign themselves as follow. Guy1 sacrifices himself if he sees 6 people with the same color. Guy2 sacrifices himself if he sees 5 people with the same color. Guy3 sacrifices himself if he sees 4 people with the same color. ...
I know this is not likely to be the correct step, but is this form of communication allowed?
|
How about where they sit? Can they choose where they sit AFTER they have seen each others hats?
|
If any of the prisoners guesses their hat color correctly, they will all go free. Otherwise, they are all executed on the spot.
Please do not forget this rule. 100% survival rate does not mean that everyone has to be right. It only means that at least 1 person has to get it right each time it's played.
0nega's solution still works.
|
On September 10 2010 06:31 tissue wrote: Could the OP clarify that no prisoner has access to any information whatsoever other than the color of the hats, and whatever they decided beforehand?
This includes: timing of writing, what other people are writing, etc
Correct, there is no communication. No timing, no looking at other people's writing, or anything else of this gimmicky nature.
|
On September 10 2010 06:32 LunarDestiny wrote: Is this allowed? They assign themselves as follow. Guy1 sacrifices himself if he sees 6 people with the same color. Guy2 sacrifices himself if he sees 5 people with the same color. Guy3 sacrifices himself if he sees 4 people with the same color.
don't know what you mean by sacrificing, but there's nothing wrong with that, since the prisoners only follow the rules they discussed beforehand and don't act on anything other than the color of the hats.
|
Since we're given that the naive strategy (completely random guesses) will achieve a success rate of ~66%, I'll assume that the hat distribution is also completely random.
Since there is no communication between the prisoners, for each prisoner, the other prisoners' answers cannot affect his own. Therefore, he ONLY has the knowledge of the other prisoners' hats. Based on this information, he must somehow improve his chances of guessing his color correctly to over 1/7.
Well, it's impossible without cheating. You have no additional information. No matter what the other prisoners' hats are, your own color is equally likely from among the 7 colors in the pool.
That is, if x is the event that your hat is color x, then
P(x) = 1/7
If y1 is the event that the 6 other prisoners' hats are of a particular ordered sequence, then
P(x | y) = 1/7, still. In fact, for any y, P(x | y) = 1/7.
In short, there is no way to improve on the completely random guess.
|
On September 10 2010 06:33 The_Pacifist wrote:Show nested quote +If any of the prisoners guesses their hat color correctly, they will all go free. Otherwise, they are all executed on the spot. Please do not forget this rule. 100% survival rate does not mean that everyone has to be right. It only means that at least 1 person has to get it right each time it's played. 0nega's solution still works.
0nega's solution does not work, as multiple people have demonstrated with the simple case.
Guy has red hat. Others have blue hat.
Guy guesses yellow, or purple, or whatever other colors are in the pool besides blue. Others guess red.
They all get it wrong.
|
Do they all have to hand their answer into the king at the same time, or can they go one by one?
|
On September 10 2010 06:34 Slithe wrote:Show nested quote +On September 10 2010 06:31 tissue wrote: Could the OP clarify that no prisoner has access to any information whatsoever other than the color of the hats, and whatever they decided beforehand?
This includes: timing of writing, what other people are writing, etc Correct, there is no communication. No timing, no looking at other people's writing, or anything else of this gimmicky nature. Yes there is, tell us the gimmick already. Is it that they can see the others hats as they sit at the table?
|
On September 10 2010 06:27 AcrossFiveJulys wrote:Show nested quote +On September 10 2010 06:07 0nega wrote:Hello! lurked at this site for some time and couldn't resist to post the solution(hopefully) + Show Spoiler +Before they get the hats, they agree, that they will all take the colour of the hat of one guy, this guy instead takes the colour which no hat he sees has I think this is the solution. If all the hats are a different color the chosen guy gets it right, if there are repeats then the other guy wearing the same color as the chosen guy gets it. Well done. I don't think this is right.
If the colors are ROYGBBV (2 blues) and the guy they decide on beforehand is wearing say a red hat, then 6 of the prisoners would pick red. They would all be wrong. The last prisoner would then see OYGBBV as the remaining colors and would still have to guess between R (red) and I (indigo).
Same thing if there were 6 red hats and 1 blue hat. If they agreed to choose the color of the blue-hatted guy, what color is the blue-hatted guy going to choose?
This wouldn't work 100% of the time if there were any multiples of any color.
|
On September 10 2010 06:36 Slithe wrote:Show nested quote +On September 10 2010 06:33 The_Pacifist wrote:If any of the prisoners guesses their hat color correctly, they will all go free. Otherwise, they are all executed on the spot. Please do not forget this rule. 100% survival rate does not mean that everyone has to be right. It only means that at least 1 person has to get it right each time it's played. 0nega's solution still works. 0nega's solution does not work, as multiple people have demonstrated with the simple case. Guy has red hat. Others have blue hat. Guy guesses yellow, or purple, or whatever other colors are in the pool besides blue. Others guess red. They all get it wrong.
if there is no form of communication, even indirect communication there is no way to get 100% probability. unless you mean 99.999999% rounded up, perhaps some people can find a way
|
LunarDestiny has the right idea..
+ Show Spoiler +If Guy1 sees 6 different colors, he picks the one not there, then the other 6 guys know to ALL pick one of the 6 colors.
If Guy1 sees 5 different colors, he picks one not there, and if Guy2 sees 5 different colors, he knows to pick the other not there, then everyone else knows to ALL pick one of the 5 colors.
And so on... until the last scenario where Guy1 sees only one color, so he'll pick one not there. Guy2 will see one color, he'll pick the second one not there, and so on until Guy7 sees 1 color, but everyone already guessed the other 6 colors so he knows no one else sees those 6 colors, so he picks the 1 color he sees.
I'm sure there's a better way of phrasing it though...=P
|
On September 10 2010 06:35 BottleAbuser wrote: Since we're given that the naive strategy (completely random guesses) will achieve a success rate of ~66%, I'll assume that the hat distribution is also completely random.
Since there is no communication between the prisoners, for each prisoner, the other prisoners' answers cannot affect his own. Therefore, he ONLY has the knowledge of the other prisoners' hats. Based on this information, he must somehow improve his chances of guessing his color correctly to over 1/7. nope. he does not have to aim at improving the chance of increasing his own hat color, all the 7 as a collective have to maximize the chance of 1 of them guessing correct. this is an important difference. i just dont know yet how to approach this problem
|
Seeing the others' hats doesn't do anything. Think of it like this.
You throw nine 6-sided dice on the table. You throw a tenth one on the floor, under the table.
You look at the nine dice. Can you think of a strategy for guessing what the tenth one rolled, one that increases your chances of guessing it over 1/6? Answer: obviously no. They're independent events.
|
Maybe if I describe a two person solution, you guys will believe that such an answer is possible. Do not look if you don't want hints.
+ Show Spoiler + Two hat colors, black and white.
Guy X's strategy: If he sees black, he guesses black. If he sees white, he guesses white.
Guy Y's strategy: If he sees black, he guesses white. If he sees white, he guesses black.
Hat combinations: BB -> X gets it right BW -> Y gets it right WB -> Y gets it right WW -> X gets it right
|
On September 10 2010 06:40 Happy.fairytail wrote:LunarDestiny has the right idea.. + Show Spoiler +If Guy1 sees 6 different colors, he picks the one not there, then the other 6 guys know to ALL pick one of the 6 colors.
If Guy1 sees 5 different colors, he picks one not there, and if Guy2 sees 5 different colors, he knows to pick the other not there, then everyone else knows to ALL pick one of the 5 colors.
And so on... until the last scenario where Guy1 sees only one color, so he'll pick one not there. Guy2 will see one color, he'll pick the second one not there, and so on until Guy7 sees 1 color, but everyone already guessed the other 6 colors so he knows no one else sees those 6 colors, so he picks the 1 color he sees. I'm sure there's a better way of phrasing it though...=P
no, as i pointed out before: even if x prisoners know which x different colors they must be wearing, they still dont know which one of them has which color. if each of them just randomly picks one of the x feasible colors, there´s still a chance for all of them to get it wrong.
|
On September 10 2010 06:41 Black Gun wrote:Show nested quote +On September 10 2010 06:35 BottleAbuser wrote: Since we're given that the naive strategy (completely random guesses) will achieve a success rate of ~66%, I'll assume that the hat distribution is also completely random.
Since there is no communication between the prisoners, for each prisoner, the other prisoners' answers cannot affect his own. Therefore, he ONLY has the knowledge of the other prisoners' hats. Based on this information, he must somehow improve his chances of guessing his color correctly to over 1/7. nope. he does not have to aim at improving the chance of increasing his own hat color, all the 7 as a collective have to maximize the chance of 1 of them guessing correct. this is an important difference. i just dont know yet how to approach this problem 
This is the correct line of thinking. As BottleAbuser mentions, there is no way for an individual to improve his independent chance of correctness, but the collective can devise a superior scheme.
|
Hyrule19026 Posts
On September 10 2010 06:27 getSome[703] wrote:Here's my best guess at an answer. It works but you may or may not argue that it involves communication. + Show Spoiler +All the prisoners before hand pick one guy. The six other players agree that if the designated prisoner is wearing a certain colored hat, one of them will begin write that hat color down on their paper (so one of the players will begin to write if the designated one is wearing a red hat, another will begin to write if he is wearing an orange hat, etc). The designated prisoner, seeing the person who is writing, will then know his hat color. If none of the prisoners are writing down anything, then his hat is the seventh color. He writes down his hat color and everyone goes free If the King has a 120 pack of Crayolas the prisoners are fucked with your strategy.
|
I've seen that type of logic before, but I'm not 100% sure how you can apply it to a larger problem, such as with 7 people.
EDIT - to expand on this:
It's kind of like the "turning a sphere inside out" puzzle. It seems counter-intuitive, yet there is a complex solution. 7 people has 823543 different possibilites, how you could come up with a simple solution is beyond me.....
|
On September 10 2010 06:40 Happy.fairytail wrote:LunarDestiny has the right idea.. + Show Spoiler +If Guy1 sees 6 different colors, he picks the one not there, then the other 6 guys know to ALL pick one of the 6 colors.
If Guy1 sees 5 different colors, he picks one not there, and if Guy2 sees 5 different colors, he knows to pick the other not there, then everyone else knows to ALL pick one of the 5 colors.
And so on... until the last scenario where Guy1 sees only one color, so he'll pick one not there. Guy2 will see one color, he'll pick the second one not there, and so on until Guy7 sees 1 color, but everyone already guessed the other 6 colors so he knows no one else sees those 6 colors, so he picks the 1 color he sees. I'm sure there's a better way of phrasing it though...=P
I don't even understand what he is saying but I can tell it makes no sense at all.
You are prisoner #1. You see 6 red hats. Possible colors are the rainbow colors. What then? Remember: Nobody can see what you write. Gonna write blue? Guy #2 (wearing red) would be like "durrr I see no blue/yellow/whatever" and do likewise, and so on. RIP
|
Everyone can guess the same color because at least one of the seven have to be of the color and only one prisoner needs to be right.
|
On September 10 2010 06:44 Slithe wrote:Show nested quote +On September 10 2010 06:41 Black Gun wrote:On September 10 2010 06:35 BottleAbuser wrote: Since we're given that the naive strategy (completely random guesses) will achieve a success rate of ~66%, I'll assume that the hat distribution is also completely random.
Since there is no communication between the prisoners, for each prisoner, the other prisoners' answers cannot affect his own. Therefore, he ONLY has the knowledge of the other prisoners' hats. Based on this information, he must somehow improve his chances of guessing his color correctly to over 1/7. nope. he does not have to aim at improving the chance of increasing his own hat color, all the 7 as a collective have to maximize the chance of 1 of them guessing correct. this is an important difference. i just dont know yet how to approach this problem  This is the correct line of thinking. As BottleAbuser mentions, there is no way for an individual to improve his independent chance of correctness, but the collective can devise a superior scheme.
i want to clarify, do all the prisoners hand in separate sheets of solutions, or do they all write on one sheet which they can see what others wrote but not who wrote them?
|
On September 10 2010 06:41 Slithe wrote:Maybe if I describe a two person solution, you guys will believe that such an answer is possible. Do not look if you don't want hints. + Show Spoiler + Two hat colors, black and white.
Guy X's strategy: If he sees black, he guesses black. If he sees white, he guesses white.
Guy Y's strategy: If he sees black, he guesses white. If he sees white, he guesses black.
Hat combinations: BB -> X gets it right BW -> Y gets it right WB -> Y gets it right WW -> X gets it right
this is cheating tho. so basically i can guess red (which is the colour of the hat of person sitting left) and that person can simply guess red cuz i just guessed whichever colour he was wearing.
|
On September 10 2010 06:47 saltywet wrote:Show nested quote +On September 10 2010 06:44 Slithe wrote:On September 10 2010 06:41 Black Gun wrote:On September 10 2010 06:35 BottleAbuser wrote: Since we're given that the naive strategy (completely random guesses) will achieve a success rate of ~66%, I'll assume that the hat distribution is also completely random.
Since there is no communication between the prisoners, for each prisoner, the other prisoners' answers cannot affect his own. Therefore, he ONLY has the knowledge of the other prisoners' hats. Based on this information, he must somehow improve his chances of guessing his color correctly to over 1/7. nope. he does not have to aim at improving the chance of increasing his own hat color, all the 7 as a collective have to maximize the chance of 1 of them guessing correct. this is an important difference. i just dont know yet how to approach this problem  This is the correct line of thinking. As BottleAbuser mentions, there is no way for an individual to improve his independent chance of correctness, but the collective can devise a superior scheme. i want to clarify, do all the prisoners hand in separate sheets of solutions, or do they all write on one sheet which they can see what others wrote but not who wrote them?
Separate sheets.
|
Retard way: Guy1 got yellow hat. He writes down red. King: Wrong. Guy2: Dude, he's right. The hat is red. King: You stupid. Guy3: Dude, he's right. King: You stupid also. Guy4: Dude, he's right. King: You stupid also. Guy5: Dude, he's right. King: You stupid also. Guy6: Dude, he's right. King: You stupid also. Guy7: Dude, he's right. King: Maybe I am color blind.
|
If Guy1 sees 6 different colors, he picks the one not there, then the other 6 guys know to ALL pick one of the 6 colors. no, the other guys don't know that guy1 sees 6 different colors. They might also see 6 different ones, or they might see that guy1 and another guy have the same color.
|
On September 10 2010 06:47 CanucksJC wrote:Show nested quote +On September 10 2010 06:41 Slithe wrote:Maybe if I describe a two person solution, you guys will believe that such an answer is possible. Do not look if you don't want hints. + Show Spoiler + Two hat colors, black and white.
Guy X's strategy: If he sees black, he guesses black. If he sees white, he guesses white.
Guy Y's strategy: If he sees black, he guesses white. If he sees white, he guesses black.
Hat combinations: BB -> X gets it right BW -> Y gets it right WB -> Y gets it right WW -> X gets it right
this is cheating tho. so basically i can guess red (which is the colour of the hat of person sitting left) and that person can simply guess red cuz i just guessed whichever colour he was wearing.
Their guesses are not based on what the other person said. They guess only based on what color they see on the other person's hat. Reread the solution, it doesn't involve them hearing each other say anything.
|
Use the adversary argument.
Suppose that the king can actually change the color of an individual's hat if he wants.
Is there a strategy that the prisoners can use, that will make sure that such a change will be provable by the individual whose hat was changed?
Remember, the only information you have is the other prisoners' hats. And you can't affect the other prisoners' answers, only your own. The other prisoners' hats are random noise. They have absolutely no bearing on what your own hat is.
Each prisoner is looking at the exact same situation.
Let's say that we change this symmetry a little bit by introducing a preset plan: Prisoner 1 will always guess red if he sees exactly one other red hat, green if he sees exactly 2 of any given color, blue if he sees 3, and so on. Prisoner 2 will start with red if he sees exactly 2 of any given color, green if he sees 3, and so on. Prisoner 3 will start with red if he sees 3 hats of a given color, and so on.
Well? Does that improve their chances? No, no it doesn't do a damn thing. Because they're independent events. The information you're given has no bearing on the decision you're making.
|
First I really thought that would be going to be something retarded, but that's actually a very nice problem. I think this is the strategy, even though I'm having a hard time proving it + Show Spoiler +Assign a number to each color (0..6) Assign a number to each prisoner (0..6) Each prisonner adds the colors he sees on all other guys + his number Sum%7 gives the color the prisoner has to announce In any possible case one (exactly one) prisoner will be right.
|
Hyrule19026 Posts
|
Dear diary,
Today I lost a goodish amount of faith in the intelligence and reading comprehension of the posters on TL.net. Was it like this before starcraft 2?
|
Hyrule19026 Posts
On September 10 2010 06:54 KarlSberg~ wrote:First I really thought that would be going to be something retarded, but that's actually a very nice problem. I think this is the strategy, even though I have a hard time proving it + Show Spoiler + Assign a number to each color (0..6) Assign a number to each prisoner (0..6) Each prisonner adds the colors he sees on all other guys + his number Sum%7 gives the color the prisoner has to announce In any possible case one (exactly one) prisoner will be right.
And once again, what if the King has a 120 pack of Crayolas? Also, the OP states there could be 2 reds and 1 of 5 other colors.
|
Hyrule19026 Posts
On September 10 2010 06:55 tissue wrote: Dear diary,
Today I lost a goodish amount of faith in the intelligence and reading comprehension of the posters on TL.net. Was it like this before starcraft 2? Quite. SC2 Strategy is the worst forum. Stick to blogs and you should be okay.
|
Let me put this another way.
By definition, if events X and Y are independent, the probability of X doesn't change if Y happens, or Y doesn't happen.
Now, it's obvious that if the prisoners' guesses are independent of each others', then there is absolutely no way to guarantee that they will survive.
So, we must conclude that they are dependent.
However, for this dependency to exist, the guesses must be made BEFORE they are seated at the table, because otherwise the information from one guess cannot be passed to the next prisoner. Then, they have absolutely no clue about the distribution of hats.
It's impossible.
|
On September 10 2010 06:54 KarlSberg~ wrote:First I really thought that would be going to be something retarded, but that's actually a very nice problem. I think this is the strategy, even though I'm having a hard time proving it + Show Spoiler +Assign a number to each color (0..6) Assign a number to each prisoner (0..6) Each prisonner adds the colors he sees on all other guys + his number Sum%7 gives the color the prisoner has to announce In any possible case one (exactly one) prisoner will be right.
ding ding ding, we have an answer.
|
Well you can do it for 2 people / 2 hats as shown earlier.
The key is finding a solution for 3 people / 3 hats, then working that up to 4 people / 4 hats, and I'm fairly sure eventually you'd be able to do 7 people / 7 hats.
I'm lazy to solve 3 people / 3 hats, but that's probably how you'd get to it.
(the key is of course that the king doesn't have a 120 pack of crayolas, it's that there are 7 specific colors in the pool)
|
On September 10 2010 06:56 tofucake wrote:Show nested quote +On September 10 2010 06:54 KarlSberg~ wrote:First I really thought that would be going to be something retarded, but that's actually a very nice problem. I think this is the strategy, even though I have a hard time proving it + Show Spoiler + Assign a number to each color (0..6) Assign a number to each prisoner (0..6) Each prisonner adds the colors he sees on all other guys + his number Sum%7 gives the color the prisoner has to announce In any possible case one (exactly one) prisoner will be right.
And once again, what if the King has a 120 pack of Crayolas? Also, the OP states there could be 2 reds and 1 of 5 other colors. The king has 7 colors as stated in the OP. About the second remark... well yes he could. So what?
|
On September 10 2010 06:56 tofucake wrote:Show nested quote +On September 10 2010 06:54 KarlSberg~ wrote:First I really thought that would be going to be something retarded, but that's actually a very nice problem. I think this is the strategy, even though I have a hard time proving it + Show Spoiler + Assign a number to each color (0..6) Assign a number to each prisoner (0..6) Each prisonner adds the colors he sees on all other guys + his number Sum%7 gives the color the prisoner has to announce In any possible case one (exactly one) prisoner will be right.
And once again, what if the King has a 120 pack of Crayolas? Also, the OP states there could be 2 reds and 1 of 5 other colors.
They know ahead of time what the 7 possible colors are.
|
Hyrule19026 Posts
So I won? Sweet.
This problem actually does seem like a mashup of several problems. All of the "prisoners with hats" problems I've heard were limited to a set of 1 color and a set of another color (usually red/blue or black/white) and they would be in a line, not a circle. IE: There would be 4 red and 3 blue.
|
this is a really nice problem. we need to find a one to one mapping between the distribution of hats and the distribution of guesses.
i think the way to solve is to break it down into simpler case, for two hats, three hats, and then generalize to 7.
EDIT SOLUTION FOR THREE HATS:
+ Show Spoiler + Let's say three colors, color 1, color 2, and color 3. The prisoners arrange themselves as prisoner 1, 2 and 3. Each prisoner has a different strategy, which combined will let them live.
Case 1: both hats you see are same color (11, 22, or 33) prisoner 1 writes down the same color prisoner 2 writes down color of one greater prisoner 3 writes down color of two greater
for example, if you see that the other hats are both color 1, (if you see 11): --prisoner 1 writes down hat 1 (same) --prisoner 2 writes down hat 2 (one greater) --prisoner 3 writes down hat 3 (two greater)
If you see 22 --prisoner 1 writes down 2 (same) --prisoner 2 writes down 3 (one greater) --prisoner 3 writes down 1 (two greater)
If you see 33 --prisoner 1 writes down 3 --2 writes down 1 --3 writes down 2
Case 2: if the hats you see are different color (12, 23, or 31) prisoner 1 writes down the remaining color prisoner 2 writes down the the left color prisoner 3 writes down the right color
*note i don't mean traditional left and write.
for example if you see 12 --1 writes down 3 --2 writes down 1 --3 writes down 2
if you see 23 --1 writes down 1 --2 writes down 2 --3 writes down 3
if you see 31 --1 writes down 2 --2 writes down 3 --3 writes down 1
This strategy will cover all 3^3 = 27 possibilities.
for cases where all numbers are same, prisoner 1 guesses right 111, 222, 333
for cases where all numbers are different, prisoner 1 guesses right 123, 231, 312 132, 213, 321 (symmetrical to first)
for cases where two numbers are same, then either prisoner 2 or prisoner 3 will guess right (prisoner 2 first case, prisoner 3 second case) 121, 113 (prisoner 2 sees 11, so he guesses 2. prisoner 3 sees 11, so he guesses 3) 232, 221 313, 332
112, 131 (prisoner 2 sees 12, so he guesses 1. prisoner 3 sees 31, so he guesses 1) 223, 212 331, 323
211, 311 (symmetrical to case above, since person 2 still sees 12, person 3 still sees 31) 322, 122 133, 233
And those are all the cases.
|
The riddle is impossible because here's what would really happen:
King: ...But there is a mathematical method where your chances of survival are 100% Prisoners: Great! Let's solve it *5 blog pages later* Prisoners: ...Screw it. The king's just trolling us, so let's just get this over with and start guessing.
|
Hyrule19026 Posts
On September 10 2010 06:57 Slithe wrote:Show nested quote +On September 10 2010 06:56 tofucake wrote:On September 10 2010 06:54 KarlSberg~ wrote:First I really thought that would be going to be something retarded, but that's actually a very nice problem. I think this is the strategy, even though I have a hard time proving it + Show Spoiler + Assign a number to each color (0..6) Assign a number to each prisoner (0..6) Each prisonner adds the colors he sees on all other guys + his number Sum%7 gives the color the prisoner has to announce In any possible case one (exactly one) prisoner will be right.
And once again, what if the King has a 120 pack of Crayolas? Also, the OP states there could be 2 reds and 1 of 5 other colors. They know ahead of time what the 7 possible colors are. Didn't you also state that there could be multiples? So would this make sense:
Possible red, orange, yellow, green, blue, indigo, violet Actual red, red, red, yellow, blue, indigo, indigo Or would it have to be
Possible red, red, red, yellow, blue, indigo, indigo Actual red, red, red, yellow, blue, indigo, indigo
|
After thinking about the problem for a while, I'm convinced there's actually hundreds (of thousands?) of solutions (just like there are 2 solutions to the 2 person problem), based on people picking a certain color based solely on the colors of their opponents. So maybe if he saw colors 1,1,3,6,5,3 in that order he'd pick color 2, and then person 2 would pick 7 and person 3 would pick... etc until someone got it right. And they'd come up with combinations for every situation. All 7^7 of them. We could plug that into a supercomputer and find one of the many answers, but the trick is finding the "simplest" solution. (One that the prisoners could memorize).
So far I've had no luck, but it has to be simple enough that there is a pattern involved, otherwise the puzzle would be nearly impossible.
|
@Tofucake The first one is possible, 7 colors are announced but not all of them have to be present in the actual set.
|
I'm not sure if this is considered communicating so maybe it's not correct, but it should be on the right track at the very least.
+ Show Spoiler + before sitting down, everyone agrees to only consider one person's hat, person A. Then, they will each assign each other a color based on the 7 colors available. If person A is wearing red, person B will be the first to give his paper to the king; it doesn't matter what person B guesses. Then person A knows his hat is red. If person A's hat is orange, person C will be the first to give his paper to the king, and person A will know his hat is orange, and so on. If person A is wearing the 7th color that is assigned to him, nobody will turn in the paper to the king and person A will know his hat is the 7th color.
edit: aww I guess I was beaten while thinking/writing this up. At least I was kind of close.
|
On September 10 2010 06:54 KarlSberg~ wrote:First I really thought that would be going to be something retarded, but that's actually a very nice problem. I think this is the strategy, even though I'm having a hard time proving it + Show Spoiler +Assign a number to each color (0..6) Assign a number to each prisoner (0..6) Each prisonner adds the colors he sees on all other guys + his number Sum%7 gives the color the prisoner has to announce In any possible case one (exactly one) prisoner will be right.
Nice work
|
@Kaze
They each guess individually, otherwise that would be communicating.
|
On September 10 2010 06:54 KarlSberg~ wrote:+ Show Spoiler +Assign a number to each color (0..6) Assign a number to each prisoner (0..6) Each prisonner adds the colors he sees on all other guys + his number Sum%7 gives the color the prisoner has to announce In any possible case one (exactly one) prisoner will be right.
nice solution Why didn't I notice the (small hint for people who want to solve it themselves)+ Show Spoiler + in the 2-player solution.
The next challenge: prove that the solution by KarlSberg is correct :-)
|
Let me try and explain Karlsberg's solution a little bit
+ Show Spoiler [solution] + We assign each color a number from 0-6
Now we can say that the prisoners are essentially getting a number, c0,c1,c2,c3,c4,c5,c6.
S = (c0 + c1 + c2 + c3 + c4 + c5 + c6) modulo 7
S has seven possible values, 0-6
At this point, what each prisoner is doing is trying to guess what S is, and solving for their own number to match S.
Prisoner 0 assumes S = 0, and solves the equation c0 = S - (c1+c2+c3+c4+c5+c6) Prisoner 1 assumes S = 1, and solves the equation c1 = S - (c0+c2+c3+c4+c5+c6) and so on..
At least one of the 7 prisoners will assume the correct S value. That prisoner will be able to guess the correct number for their own hat.
|
On September 10 2010 06:58 tofucake wrote: So I won? Sweet.
This problem actually does seem like a mashup of several problems. All of the "prisoners with hats" problems I've heard were limited to a set of 1 color and a set of another color (usually red/blue or black/white) and they would be in a line, not a circle. IE: There would be 4 red and 3 blue.
yeah i'm familiar with that kind of hat problem but i've never heard of a problem with 7 hat colors before.
|
Guys this is really easy: + Show Spoiler + Assign each color a value 0-6. Each person takes sum of all the colors he sees and says the result in mod 7 (says the corresponding color to the sum). If you let a_1 be the first person's color, a_2 second guy's, etc, and S the sum of all, the first person will say S-a_1 (mod 7), second S-a_2, etc. Now it is possible to express all a_2, a_3, ... a_7 in terms of a_1. Add all values (expressed in terms of a_1) and you get 7a_1 + X, for some X. X = S (mod 7). Now the only thing the last person has to do is subtract and get his color.
|
On September 10 2010 06:57 Slithe wrote:Show nested quote +On September 10 2010 06:54 KarlSberg~ wrote:First I really thought that would be going to be something retarded, but that's actually a very nice problem. I think this is the strategy, even though I'm having a hard time proving it + Show Spoiler +Assign a number to each color (0..6) Assign a number to each prisoner (0..6) Each prisonner adds the colors he sees on all other guys + his number Sum%7 gives the color the prisoner has to announce In any possible case one (exactly one) prisoner will be right.
ding ding ding, we have an answer.
i was skeptical about this answer, i messed around with some calculations in excel, i can find counter examples to this and thus this answer does not solve the problem 100%
prisoner 0 1 2 3 4 5 6 his color 6 6 6 1 1 1 1 written color 2 2 2 3 3 3 3
|
On September 10 2010 07:07 Slithe wrote:Let me try and explain Karlsberg's solution a little bit + Show Spoiler [solution] + We assign each color a number from 0-6
Now we can say that the prisoners are essentially getting a number, c0,c1,c2,c3,c4,c5,c6.
S = (c0 + c1 + c2 + c3 + c4 + c5 + c6) modulo 7
S has seven possible values, 0-6
At this point, what each prisoner is doing is trying to guess what S is, and solving for their own number to match S.
Prisoner 0 assumes S = 0, and solves the equation c0 = S - (c1+c2+c3+c4+c5+c6) Prisoner 1 assumes S = 1, and solves the equation c1 = S - (c0+c2+c3+c4+c5+c6) and so on..
At least one of the 7 prisoners will assume the correct S value. That prisoner will be able to guess the correct number for their own hat.
I am so embarrassed.
|
On September 10 2010 07:07 Slithe wrote:Let me try and explain Karlsberg's solution a little bit + Show Spoiler [solution] + We assign each color a number from 0-6
Now we can say that the prisoners are essentially getting a number, c0,c1,c2,c3,c4,c5,c6.
S = (c0 + c1 + c2 + c3 + c4 + c5 + c6) modulo 7
S has seven possible values, 0-6
At this point, what each prisoner is doing is trying to guess what S is, and solving for their own number to match S.
Prisoner 0 assumes S = 0, and solves the equation c0 = S - (c1+c2+c3+c4+c5+c6) Prisoner 1 assumes S = 1, and solves the equation c1 = S - (c0+c2+c3+c4+c5+c6) and so on..
At least one of the 7 prisoners will assume the correct S value. That prisoner will be able to guess the correct number for their own hat.
Ah I read Karlsberg's solution and was typing up the explanation but I thought I'd refresh to see if someone else had mentioned it already. I'm surprised so many people thought there was a silly gimmick to this problem despite it being called a math puzzle.
|
On September 10 2010 07:12 saltywet wrote:Show nested quote +On September 10 2010 06:57 Slithe wrote:On September 10 2010 06:54 KarlSberg~ wrote:First I really thought that would be going to be something retarded, but that's actually a very nice problem. I think this is the strategy, even though I'm having a hard time proving it + Show Spoiler +Assign a number to each color (0..6) Assign a number to each prisoner (0..6) Each prisonner adds the colors he sees on all other guys + his number Sum%7 gives the color the prisoner has to announce In any possible case one (exactly one) prisoner will be right.
ding ding ding, we have an answer. i was skeptical about this answer, i messed around with some calculations in excel, i can find counter examples to this and thus this answer does not solve the problem 100% prisoner 0 1 2 3 4 5 6 his color 6 6 6 1 1 1 1 written color 2 2 2 3 3 3 3
I think you forgot to add the prisoner numbers, since prisoners 0,1, and 2 all see the same sum but are guessing the same number...
|
saltywet, you made a mistake somewhere. Prisoner #1 would answer 3, not 2. (6*2 + 1*4 + 1, his own number). Probably you didn't add the prisoner numbers before taking the modulus.
|
On September 10 2010 07:12 saltywet wrote:Show nested quote +On September 10 2010 06:57 Slithe wrote:On September 10 2010 06:54 KarlSberg~ wrote:First I really thought that would be going to be something retarded, but that's actually a very nice problem. I think this is the strategy, even though I'm having a hard time proving it + Show Spoiler +Assign a number to each color (0..6) Assign a number to each prisoner (0..6) Each prisonner adds the colors he sees on all other guys + his number Sum%7 gives the color the prisoner has to announce In any possible case one (exactly one) prisoner will be right.
ding ding ding, we have an answer. i was skeptical about this answer, i messed around with some calculations in excel, i can find counter examples to this and thus this answer does not solve the problem 100% prisoner 0 1 2 3 4 5 6 his color 6 6 6 1 1 1 1 written color 2 2 2 3 3 3 3
prisoner 0 1 2 3 4 5 6 his color 6 6 6 1 1 1 1 sum of others 2 2 2 0 0 0 0 written color 5 6 0 3 4 5 6
prisoner 1 gets it right.
|
Basically you need to map out all the possible combinations then come up with a guessing strategy for each player that makes a certain # of those combinations 'wins' instead of losses such that the combined strategies make each possible outcome a win.
Each guessing strategy has to win for square root of n^n unique combinations where n is the # of people (so for 2 each person has a strategy that wins squareroot of 2*2 BB WW is one person BW WB is another). For 3 people each strategy needs to win for 9 unique cases.
Edit looks like someone got the answer vs my explanation of what the answer requires.
|
Damn, that is actually pretty simple.....
|
Possible red, orange, yellow, green, blue, indigo, violet Actual red, red, red, yellow, blue, indigo, indigo
Red = 0, Orange = 1, Yellow = 2, Green = 3, Blue = 4, Indigo = 5, Violet = 6
Prisoner 0 (red) Sees red, red, yellow, blue, indigo, indigo for a sum of 16. Adds his own number, 0. 16%7 = 2. Guesses yellow.
Prisoner 1 (red) Sees red, red, yellow, blue, indigo, indigo for a sum of 16. Adds his own number, 1. 17%7 = 3. Guesses green.
Prisoner 2 (red) Sees red, red, yellow, blue, indigo, indigo for a sum of 16. Adds his own number, 2. 18%7 = 4. Guesses blue.
Prisoner 3 (yellow) Sees red, red, red, blue, indigo, indigo for a sum of 14. Adds his own number, 3. 17%7 = 3. Guesses green.
Prisoner 4 (blue) Sees red, red, red, yellow, indigo, indigo for a sum of 12. Adds his own number, 4. 16%7 = 2. Guesses yellow.
Prisoner 5 (indigo) Sees red, red, red, yellow, blue, indigo for a sum of 11. Adds his own number, 5. 16%7 = 2. Guesses yellow.
Prisoner 6 (indigo) Sees red, red, red, yellow, blue, indigo for a sum of 11. Adds his own number, 6. 17%7 = 2. Guesses green.
All prisoners die.
Let me know if there's a problem with my proof by contradiction, but I think Karlsberg's solution doesn't work.
+ Show Spoiler [Non-mathematical answer] + This doesn't break any rules in the OP. Two prisoners agree beforehand to write each other's names on their pieces of paper. They also write the color of the hat that the other person is wearing. Bam, foolproof answer.
|
On September 10 2010 07:16 Slithe wrote:Show nested quote +On September 10 2010 07:12 saltywet wrote:On September 10 2010 06:57 Slithe wrote:On September 10 2010 06:54 KarlSberg~ wrote:First I really thought that would be going to be something retarded, but that's actually a very nice problem. I think this is the strategy, even though I'm having a hard time proving it + Show Spoiler +Assign a number to each color (0..6) Assign a number to each prisoner (0..6) Each prisonner adds the colors he sees on all other guys + his number Sum%7 gives the color the prisoner has to announce In any possible case one (exactly one) prisoner will be right.
ding ding ding, we have an answer. i was skeptical about this answer, i messed around with some calculations in excel, i can find counter examples to this and thus this answer does not solve the problem 100% prisoner 0 1 2 3 4 5 6 his color 6 6 6 1 1 1 1 written color 2 2 2 3 3 3 3 prisoner 0 1 2 3 4 5 6 his color 6 6 6 1 1 1 1 sum of others 2 2 2 0 0 0 0 written color 5 6 0 3 4 5 6 prisoner 1 gets it right.
i got some mistake, written color i actually get 2 3 4 3 4 5 6
using [(number* of prisoner) + (color of other prisoners)]%7
how did you get 5 6 0 for prisoner 0 1 2
|
Well, it looks like it was a valid answer after all. I don't feel too bad for not getting it since I had to google what all that "modulus" stuff was ("17%7? That's not on my 4 function calculator!"), so the answer was a little out of my possible reach.
But now I feel stupid for having to google it.
|
On September 10 2010 07:14 Lark wrote:Show nested quote +On September 10 2010 07:12 saltywet wrote:On September 10 2010 06:57 Slithe wrote:On September 10 2010 06:54 KarlSberg~ wrote:First I really thought that would be going to be something retarded, but that's actually a very nice problem. I think this is the strategy, even though I'm having a hard time proving it + Show Spoiler +Assign a number to each color (0..6) Assign a number to each prisoner (0..6) Each prisonner adds the colors he sees on all other guys + his number Sum%7 gives the color the prisoner has to announce In any possible case one (exactly one) prisoner will be right.
ding ding ding, we have an answer. i was skeptical about this answer, i messed around with some calculations in excel, i can find counter examples to this and thus this answer does not solve the problem 100% prisoner 0 1 2 3 4 5 6 his color 6 6 6 1 1 1 1 written color 2 2 2 3 3 3 3 I think you forgot to add the prisoner numbers, since prisoners 0,1, and 2 all see the same sum but are guessing the same number...
Even so it does not work: consider 0 1 2 3 4 5 6 0 2 2 3 4 5 6 1 1 1 1 1 1 1
|
Prisoner 0 1 2 3 4 5 6 Color 0 0 0 2 4 5 5 Sum 2 2 2 0 5 4 4 Guess 2 3 4 3 2 2 3
Simpler form.
|
On September 10 2010 07:25 jalstar wrote:Show nested quote +Possible red, orange, yellow, green, blue, indigo, violet Actual red, red, red, yellow, blue, indigo, indigo Red = 0, Orange = 1, Yellow = 2, Green = 3, Blue = 4, Indigo = 5, Violet = 6 Prisoner 0 (red) Sees red, red, yellow, blue, indigo, indigo for a sum of 16. Adds his own number, 0. 16%7 = 2. Guesses yellow. Prisoner 1 (red) Sees red, red, yellow, blue, indigo, indigo for a sum of 16. Adds his own number, 1. 17%7 = 3. Guesses green. Prisoner 2 (red) Sees red, red, yellow, blue, indigo, indigo for a sum of 16. Adds his own number, 2. 18%7 = 4. Guesses blue. Prisoner 3 (yellow) Sees red, red, red, blue, indigo, indigo for a sum of 14. Adds his own number, 3. 17%7 = 3. Guesses green. Prisoner 4 (blue) Sees red, red, red, yellow, indigo, indigo for a sum of 12. Adds his own number, 4. 16%7 = 2. Guesses yellow. Prisoner 5 (indigo) Sees red, red, red, yellow, blue, indigo for a sum of 11. Adds his own number, 5. 16%7 = 2. Guesses yellow. Prisoner 6 (indigo) Sees red, red, red, yellow, blue, indigo for a sum of 11. Adds his own number, 6. 17%7 = 2. Guesses green. All prisoners die. Let me know if there's a problem with my proof by contradiction, but I think Karlsberg's solution doesn't work. + Show Spoiler [Non-mathematical answer] + This doesn't break any rules in the OP. Two prisoners agree beforehand to write each other's names on their pieces of paper. They also write the color of the hat that the other person is wearing. Bam, foolproof answer.
You're right, Karlsberg actually didn't give quite the right solution, but it looked similar to the right answer so I got tricked. Consult my spoiler for the correct solution.
Instead of doing sum + own_number = color, you do own_number - sum = color. In your example, I believe prisoner 2 has 2 - 16 = 0 % 7, and guesses red correctly.
|
On September 10 2010 07:30 gondolin wrote:Show nested quote +On September 10 2010 07:14 Lark wrote:On September 10 2010 07:12 saltywet wrote:On September 10 2010 06:57 Slithe wrote:On September 10 2010 06:54 KarlSberg~ wrote:First I really thought that would be going to be something retarded, but that's actually a very nice problem. I think this is the strategy, even though I'm having a hard time proving it + Show Spoiler +Assign a number to each color (0..6) Assign a number to each prisoner (0..6) Each prisonner adds the colors he sees on all other guys + his number Sum%7 gives the color the prisoner has to announce In any possible case one (exactly one) prisoner will be right.
ding ding ding, we have an answer. i was skeptical about this answer, i messed around with some calculations in excel, i can find counter examples to this and thus this answer does not solve the problem 100% prisoner 0 1 2 3 4 5 6 his color 6 6 6 1 1 1 1 written color 2 2 2 3 3 3 3 I think you forgot to add the prisoner numbers, since prisoners 0,1, and 2 all see the same sum but are guessing the same number... Even so it does not work: consider 0 1 2 3 4 5 6 0 2 2 3 4 5 6 1 1 1 1 1 1 1
prisoner 1 would actually be 0, but that still does not change the point
|
I'm probably not understanding the solution, but how does each prisoner know what number to label himself if they cannot communicate?
|
On September 10 2010 07:25 jalstar wrote:Show nested quote +Possible red, orange, yellow, green, blue, indigo, violet Actual red, red, red, yellow, blue, indigo, indigo Red = 0, Orange = 1, Yellow = 2, Green = 3, Blue = 4, Indigo = 5, Violet = 6 Prisoner 0 (red) Sees red, red, yellow, blue, indigo, indigo for a sum of 16. Adds his own number, 0. 16%7 = 2. Guesses yellow. Prisoner 1 (red) Sees red, red, yellow, blue, indigo, indigo for a sum of 16. Adds his own number, 1. 17%7 = 3. Guesses green. Prisoner 2 (red) Sees red, red, yellow, blue, indigo, indigo for a sum of 16. Adds his own number, 2. 18%7 = 4. Guesses blue. Prisoner 3 (yellow) Sees red, red, red, blue, indigo, indigo for a sum of 14. Adds his own number, 3. 17%7 = 3. Guesses green. Prisoner 4 (blue) Sees red, red, red, yellow, indigo, indigo for a sum of 12. Adds his own number, 4. 16%7 = 2. Guesses yellow. Prisoner 5 (indigo) Sees red, red, red, yellow, blue, indigo for a sum of 11. Adds his own number, 5. 16%7 = 2. Guesses yellow. Prisoner 6 (indigo) Sees red, red, red, yellow, blue, indigo for a sum of 11. Adds his own number, 6. 17%7 = 2. Guesses green. All prisoners die. Let me know if there's a problem with my proof by contradiction, but I think Karlsberg's solution doesn't work. + Show Spoiler [Non-mathematical answer] + This doesn't break any rules in the OP. Two prisoners agree beforehand to write each other's names on their pieces of paper. They also write the color of the hat that the other person is wearing. Bam, foolproof answer.
you subtract the sum from the prisoner's own number, not add.
so we have
0-16 = 5 mod 7 1-16 = 6 2-16 = 0 3-14 = 3 4-12 = 6 5-10 = 2 6-10 = 1
prisoner 2 gets it right
|
this solution doesnt work because it relies on the prisoners communicating their own number, which is not possible with the scenario in the opening post.
|
On September 10 2010 07:28 saltywet wrote:Show nested quote +On September 10 2010 07:16 Slithe wrote:On September 10 2010 07:12 saltywet wrote:On September 10 2010 06:57 Slithe wrote:On September 10 2010 06:54 KarlSberg~ wrote:First I really thought that would be going to be something retarded, but that's actually a very nice problem. I think this is the strategy, even though I'm having a hard time proving it + Show Spoiler +Assign a number to each color (0..6) Assign a number to each prisoner (0..6) Each prisonner adds the colors he sees on all other guys + his number Sum%7 gives the color the prisoner has to announce In any possible case one (exactly one) prisoner will be right.
ding ding ding, we have an answer. i was skeptical about this answer, i messed around with some calculations in excel, i can find counter examples to this and thus this answer does not solve the problem 100% prisoner 0 1 2 3 4 5 6 his color 6 6 6 1 1 1 1 written color 2 2 2 3 3 3 3 prisoner 0 1 2 3 4 5 6 his color 6 6 6 1 1 1 1 sum of others 2 2 2 0 0 0 0 written color 5 6 0 3 4 5 6 prisoner 1 gets it right. i got some mistake, written color i actually get 2 3 4 3 4 5 6 using [(number* of prisoner) + (color of other prisoners)]%7 how did you get 5 6 0 for prisoner 0 1 2
Karlsberg's solution was slightly wrong, look at my solution for the way to do it.
|
On September 10 2010 07:33 Glull wrote: this solution doesnt work because it relies on the prisoners communicating their own number, which is not possible with the scenario in the opening post.
The problem clearly states the prisoners know the colors and they can't communicate after being seating. It makes no mention of before.
|
Can someone post a link to the proof of the solution? I'm too tried to bother thinking about this atm and don't see the method people could have used to arrive at the answer.
Also yes the amount of people trying to solve this blatant maths puzzle via communication was lol.
|
On September 10 2010 07:33 Glull wrote: this solution doesnt work because it relies on the prisoners communicating their own number, which is not possible with the scenario in the opening post.
The prisoners designate a number to each guy beforehand. They are free to communicate a strategy before sitting down.
@Muff2n, I posted the solution in the opening post.
|
On September 10 2010 07:32 saltywet wrote:Show nested quote +On September 10 2010 07:30 gondolin wrote:On September 10 2010 07:14 Lark wrote:On September 10 2010 07:12 saltywet wrote:On September 10 2010 06:57 Slithe wrote:On September 10 2010 06:54 KarlSberg~ wrote:First I really thought that would be going to be something retarded, but that's actually a very nice problem. I think this is the strategy, even though I'm having a hard time proving it + Show Spoiler +Assign a number to each color (0..6) Assign a number to each prisoner (0..6) Each prisonner adds the colors he sees on all other guys + his number Sum%7 gives the color the prisoner has to announce In any possible case one (exactly one) prisoner will be right.
ding ding ding, we have an answer. i was skeptical about this answer, i messed around with some calculations in excel, i can find counter examples to this and thus this answer does not solve the problem 100% prisoner 0 1 2 3 4 5 6 his color 6 6 6 1 1 1 1 written color 2 2 2 3 3 3 3 I think you forgot to add the prisoner numbers, since prisoners 0,1, and 2 all see the same sum but are guessing the same number... Even so it does not work: consider 0 1 2 3 4 5 6 0 2 2 3 4 5 6 1 1 1 1 1 1 1 prisoner 1 would actually be 0, but that still does not change the point 
Oh yeah thanks, I suck at calculus  I started from 0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 0 0 0 0 0 0
then add 1 to the color of number 1, or add two to the color of number 2, ... The same counter example work if you substract the number of the person, you start with 0 1 2 3 4 5 6 0 -1 -2 -3 -4 -5 -6 0 0 0 0 0 0 0 and you substract 1 to the colors of number 1, or two to the color of number 2, ...
Edit: Howewer it works indeed if we substract the counted color: the person i announce i-(S-c_i), and he wins when i-(S-c_i)=c_i, so when i=S.
|
I guess I'm not a mathematician after all :D but here's my ENFP intuitive way of thinking about it... in a 3 hat problem, there are 27 possible combinations. Each person will see 9 possible scenarios. If you find a way such that each person gives a different answer for each of the 27 possible combinations using the 9 scenioars they see, you can cover all your bases.
For example, Guy1 sees 11 and if he choses 1, then 111 is taken care of, but Guy1 is no longer able to test for 211 and 311. However, Guy2 will be able to test for 211 when he sees 21 and chooses 1 and Guy3 will be able to test for 311 when he sees 31 and chooses 1.
However, then Guy2 will be unable to test for 221 and 231, and Guy3 is unable to test for 312 and 313.
But as long as you're able to keep going and make sure the other 2 guys can test for the combinations you can't test, you're ok -- and there is ONE solution, given like I said, that will cover 27 combinations, by using 3 people who each will see 9 scenarios.
And if you extend that to 7 hats, there are 823,543 combinations, 117,649 scenarios and 7 guys. Haha...I wonder if there's a way to solve this problem using matrices rather than straight up mod equations...
|
On September 10 2010 07:43 Happy.fairytail wrote: I guess I'm not a mathematician after all :D but here's my ENFP intuitive way of thinking about it... in a 3 hat problem, there are 27 possible combinations. Each person will see 9 possible scenarios. If you find a way such that each person gives a different answer for each of the 27 possible combinations using the 9 scenioars they see, you can cover all your bases.
For example, Guy1 sees 11 and if he choses 1, then 111 is taken care of, but Guy1 is no longer able to test for 211 and 311. However, Guy2 will be able to test for 211 when he sees 21 and chooses 1 and Guy3 will be able to test for 311 when he sees 31 and chooses 1.
However, then Guy2 will be unable to test for 221 and 231, and Guy3 is unable to test for 312 and 313.
But as long as you're able to keep going and make sure the other 2 guys can test for the combinations you can't test, you're ok -- and there is ONE solution, given like I said, that will cover 27 combinations, by using 3 people who each will see 9 scenarios.
And if you extend that to 7 hats, there are 823,543 combinations, 117,649 scenarios and 7 guys. Haha...I wonder if there's a way to solve this problem using matrices rather than straight up mod equations...
Your way of thinking about it is good. Now all you have to do is find a proper mapping from the combinations to the people's guesses
|
On September 10 2010 07:36 Slithe wrote:Show nested quote +On September 10 2010 07:28 saltywet wrote:On September 10 2010 07:16 Slithe wrote:On September 10 2010 07:12 saltywet wrote:On September 10 2010 06:57 Slithe wrote:On September 10 2010 06:54 KarlSberg~ wrote:First I really thought that would be going to be something retarded, but that's actually a very nice problem. I think this is the strategy, even though I'm having a hard time proving it + Show Spoiler +Assign a number to each color (0..6) Assign a number to each prisoner (0..6) Each prisonner adds the colors he sees on all other guys + his number Sum%7 gives the color the prisoner has to announce In any possible case one (exactly one) prisoner will be right.
ding ding ding, we have an answer. i was skeptical about this answer, i messed around with some calculations in excel, i can find counter examples to this and thus this answer does not solve the problem 100% prisoner 0 1 2 3 4 5 6 his color 6 6 6 1 1 1 1 written color 2 2 2 3 3 3 3 prisoner 0 1 2 3 4 5 6 his color 6 6 6 1 1 1 1 sum of others 2 2 2 0 0 0 0 written color 5 6 0 3 4 5 6 prisoner 1 gets it right. i got some mistake, written color i actually get 2 3 4 3 4 5 6 using [(number* of prisoner) + (color of other prisoners)]%7 how did you get 5 6 0 for prisoner 0 1 2 Karlsberg's solution was slightly wrong, look at my solution for the way to do it.
i still dont know how you got 5 6 0
say for prison 0, color of other prisoners = 6+6+4*1 = 16, 0 -16 = 16, mod7 = 2, so how did you get 5?
anyways i used your solution for another problem
[(number of prison)-(color of other prisoners)]%7
prisoner 0 1 2 3 4 5 6 his color 6 6 6 3 3 2 3 written color 2 1 0 2 1 1 6
solution check: prisoner 0 0-(6+6+3+3+2+3) = 23, mod7 = 2 prisoner 1 1-(6+6+3+3+2+3) = 22, mod7 = 1 prisoner 2 2-(6+6+3+3+2+3) = 21, mod7 = 0 prisoner 3 3-(6+6+6+3+2+3) = 23, mod7 = 2 prisoner 4 4-(6+6+6+3+2+3) = 22, mod7 = 1 prisoner 5 5-(6+6+6+3+3+3) = 22, mod7 = 1 prisoner 6 6-(6+6+6+3+2+3) = 20, mod7 = 6
|
Slithe's explanation is pretty clear. So, of course, I will restate it.
+ Show Spoiler +We start with the fact that the summation of the values of the hats modulo 7 is a number between 0 and 6, inclusive, and it doesn't change once the hats have been assigned.
That is, [hat1 + hat2 + hat3 + hat4 + hat5 + hat6 + hat7] % 7 = C, for some number C that can't change.
For each prisoner, there is one unknown hat (his own). There is also the unknown value C. If he guesses a value for C, then he can solve for his own hat value.
Since there are 7 possible values for C, each prisoner agrees to choose a different value to guess for C.
Then, exactly 1 prisoner will choose the correct value (the other 6 will choose the wrong values). He will then proceed to guess his own hat value correctly.
Note that this won't work if you have fewer prisoners than hat colors.
|
I can prove that Slithe's answer is correct rigorously:
Let c_i denote the color (0-6) for player i. Let C denote the sum of all c_i
Now, we know that x = C (mod 7) for some value of x between 0 and 6. This is a property of mods.
Now let's say each player i picks a color p_i = i - (C - c_i) (mod 7). (C - c_i) is observable by looking at the sum of all the other hats.
So p_i = i - C + c_i (mod 7). For player x though, we know that x = C (mod 7). So if we add these two mod relations together (another property of mods) we get:
p_x + x = x - C + c_x + C (mod 7).
Therefore, p_x + x = c_x + x (mod 7)
And since x is less than 7,
p_x = c_x. So player x will pick his number!
|
On September 10 2010 07:48 saltywet wrote:Show nested quote +On September 10 2010 07:36 Slithe wrote:On September 10 2010 07:28 saltywet wrote:On September 10 2010 07:16 Slithe wrote:On September 10 2010 07:12 saltywet wrote:On September 10 2010 06:57 Slithe wrote:On September 10 2010 06:54 KarlSberg~ wrote:First I really thought that would be going to be something retarded, but that's actually a very nice problem. I think this is the strategy, even though I'm having a hard time proving it + Show Spoiler +Assign a number to each color (0..6) Assign a number to each prisoner (0..6) Each prisonner adds the colors he sees on all other guys + his number Sum%7 gives the color the prisoner has to announce In any possible case one (exactly one) prisoner will be right.
ding ding ding, we have an answer. i was skeptical about this answer, i messed around with some calculations in excel, i can find counter examples to this and thus this answer does not solve the problem 100% prisoner 0 1 2 3 4 5 6 his color 6 6 6 1 1 1 1 written color 2 2 2 3 3 3 3 prisoner 0 1 2 3 4 5 6 his color 6 6 6 1 1 1 1 sum of others 2 2 2 0 0 0 0 written color 5 6 0 3 4 5 6 prisoner 1 gets it right. i got some mistake, written color i actually get 2 3 4 3 4 5 6 using [(number* of prisoner) + (color of other prisoners)]%7 how did you get 5 6 0 for prisoner 0 1 2 Karlsberg's solution was slightly wrong, look at my solution for the way to do it. i still dont know how you got 5 6 0 say for prison 0, color of other prisoners = 6+6+4*1 = 16, 0 -16 = 16, mod7 = 2, so how did you get 5? anyways i used your solution for another problem [(number of prison)-(color of other prisoners)]%7 prisoner 0 1 2 3 4 5 6 his color 6 6 6 3 3 2 3 written color 2 1 0 2 1 1 6 solution check: prisoner 0 0-(6+6+3+3+2+3) = 23, mod7 = 2 prisoner 1 1-(6+6+3+3+2+3) = 22, mod7 = 1 prisoner 2 2-(6+6+3+3+2+3) = 21, mod7 = 0 prisoner 3 3-(6+6+6+3+2+3) = 23, mod7 = 2 prisoner 4 4-(6+6+6+3+2+3) = 22, mod7 = 1 prisoner 5 5-(6+6+6+3+3+3) = 22, mod7 = 1 prisoner 6 6-(6+6+6+3+2+3) = 20, mod7 = 6
0-16 = -16 = 5 mod 7 equivalently, 21 = 0 mod 7, 21-16 = 5 mod 7
For your new solution, I'll just arithmetic check your first prisoner. 0-(6+6+3+3+2+3) = -23, mod7 = 5
|
Hyrule19026 Posts
On September 10 2010 07:48 saltywet wrote: say for prison 0, color of other prisoners = 6+6+4*1 = 16, 0 -16 = 16, mod7 = 2, so how did you get 5?
I still don't know how you got -16 = 16
But his logic, while wrong, is sound. -2 is outside 0..7, so add 7. -2+7=5
But that's not how modulo works.
|
On September 10 2010 07:55 Slithe wrote:Show nested quote +On September 10 2010 07:48 saltywet wrote:On September 10 2010 07:36 Slithe wrote:On September 10 2010 07:28 saltywet wrote:On September 10 2010 07:16 Slithe wrote:On September 10 2010 07:12 saltywet wrote:On September 10 2010 06:57 Slithe wrote:On September 10 2010 06:54 KarlSberg~ wrote:First I really thought that would be going to be something retarded, but that's actually a very nice problem. I think this is the strategy, even though I'm having a hard time proving it + Show Spoiler +Assign a number to each color (0..6) Assign a number to each prisoner (0..6) Each prisonner adds the colors he sees on all other guys + his number Sum%7 gives the color the prisoner has to announce In any possible case one (exactly one) prisoner will be right.
ding ding ding, we have an answer. i was skeptical about this answer, i messed around with some calculations in excel, i can find counter examples to this and thus this answer does not solve the problem 100% prisoner 0 1 2 3 4 5 6 his color 6 6 6 1 1 1 1 written color 2 2 2 3 3 3 3 prisoner 0 1 2 3 4 5 6 his color 6 6 6 1 1 1 1 sum of others 2 2 2 0 0 0 0 written color 5 6 0 3 4 5 6 prisoner 1 gets it right. i got some mistake, written color i actually get 2 3 4 3 4 5 6 using [(number* of prisoner) + (color of other prisoners)]%7 how did you get 5 6 0 for prisoner 0 1 2 Karlsberg's solution was slightly wrong, look at my solution for the way to do it. i still dont know how you got 5 6 0 say for prison 0, color of other prisoners = 6+6+4*1 = 16, 0 -16 = 16, mod7 = 2, so how did you get 5? anyways i used your solution for another problem [(number of prison)-(color of other prisoners)]%7 prisoner 0 1 2 3 4 5 6 his color 6 6 6 3 3 2 3 written color 2 1 0 2 1 1 6 solution check: prisoner 0 0-(6+6+3+3+2+3) = 23, mod7 = 2 prisoner 1 1-(6+6+3+3+2+3) = 22, mod7 = 1 prisoner 2 2-(6+6+3+3+2+3) = 21, mod7 = 0 prisoner 3 3-(6+6+6+3+2+3) = 23, mod7 = 2 prisoner 4 4-(6+6+6+3+2+3) = 22, mod7 = 1 prisoner 5 5-(6+6+6+3+3+3) = 22, mod7 = 1 prisoner 6 6-(6+6+6+3+2+3) = 20, mod7 = 6 0-16 = -16 = 5 mod 7 equivalently, 21 = 0 mod 7, 21-16 = 5 mod 7 For your new solution, I'll just arithmetic check your first prisoner. 0-(6+6+3+3+2+3) = -23, mod7 = 5
you have to get a positive integer for the remainder.
-16 divided by 7 could be -2 with a remainder -2, but in order to make it positive, it would be -3 remainder 5. 7*-3 = -21 +5 = 16.
|
lol I think this thread has degraded to the point where people cannot even agree on how modular arithmetic works.
Also, -21 +5 = -16, not 16.
Am I getting trolled here?
|
lulz.
phant, mod works like this: If you have x % y = z, then that means
y * c + z = x, for some integer c.
So, if we are looking at -16 % 7 = 5, let's verify that it works.
7 * -3 + 5 = -21 + 5 = -16, so yes it works. (we can use -3 because -3 is an integer.)
|
On September 10 2010 08:20 BottleAbuser wrote: lulz.
phant, mod works like this: If you have x % y = z, then that means
y * c + z = x, for some integer c.
So, if we are looking at -16 % 7 = 5, let's verify that it works.
7 * -3 + 5 = -21 + 5 = -16, so yes it works. (we can use -3 because -3 is an integer.)
which...is exactly what i was saying. the mod function finds the remainder, of course you can define the remainder in many ways, but in most cases like this you want it to be positive.
edit: oh I see, I forgot to throw a negative sign on 16, typo on my part.
2nd edit, I also just noticed I quoted the wrong post, wow i am not on top of things today, I was responding to the person who you quoted, Slithe
|
Bottleabuser has put it nicely ty.
Now I just need to become a little more happy with mod (first time I saw the % I thought the guy must have miss-pressed / or ^ or something lol)
|
This problem is pretty interesting. It took my roommates a bit of time to figure out, but in hindsight it's really simple (which is why it's interesting). Basically you just make a group out of the hat colors and the prisoners need to come to an agreement of what function to apply to the elements. In the case of the solution, they decide that they should add up all the group elements (hat colors) that they see. But really "adding" can be any group operator. In the case of me and my roommates we ended up with a multiplicative group.
Since this is a group, the result is an element of the group. So each person just has to account for one element of the group. This way you're guaranteed that someone is right. It doesn't work if there are more hat colors than prisoners because you can never account for every element. The result might map to a different element that someone isn't guessing. Obviously this will still work if there are more prisoners than colors because you can just make up colors to fill in the empty space.
But is there a different solution that would maximize the number of correct guesses if there are less hat colors?
|
|
|
|