• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 15:41
CEST 21:41
KST 04:41
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
BGE Stara Zagora 2025: Info & Preview25Code S RO12 Preview: GuMiho, Bunny, SHIN, ByuN3The Memories We Share - Facing the Final(?) GSL46Code S RO12 Preview: Cure, Zoun, Solar, Creator4[ASL19] Finals Preview: Daunting Task30
Community News
[BSL20] ProLeague: Bracket Stage & Dates7GSL Ro4 and Finals moved to Sunday June 15th12Weekly Cups (May 27-June 1): ByuN goes back-to-back0EWC 2025 Regional Qualifier Results26Code S RO12 Results + RO8 Groups (2025 Season 2)3
StarCraft 2
General
Magnus Carlsen and Fabi review Clem's chess game. The SCII GOAT: A statistical Evaluation BGE Stara Zagora 2025: Info & Preview Jim claims he and Firefly were involved in match-fixing GSL Ro4 and Finals moved to Sunday June 15th
Tourneys
Bellum Gens Elite: Stara Zagora 2025 $5,100+ SEL Season 2 Championship (SC: Evo) SOOPer7s Showmatches 2025 Cheeseadelphia 2025 - Open Bracket LAN! $25,000+ WardiTV 2025 Series
Strategy
[G] Darkgrid Layout Simple Questions Simple Answers [G] PvT Cheese: 13 Gate Proxy Robo
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 476 Charnel House Mutation # 475 Hard Target Mutation # 474 Futile Resistance Mutation # 473 Cold is the Void
Brood War
General
I made an ASL quiz BGH auto balance -> http://bghmmr.eu/ [BSL20] ProLeague: Bracket Stage & Dates BW General Discussion Will foreigners ever be able to challenge Koreans?
Tourneys
[Megathread] Daily Proleagues [BSL20] ProLeague Bracket Stage - Day 2 [BSL20] ProLeague Bracket Stage - Day 1 [BSL 2v2] ProLeague Season 3 - Friday 21:00 CET
Strategy
I am doing this better than progamers do. [G] How to get started on ladder as a new Z player
Other Games
General Games
Path of Exile Nintendo Switch Thread Stormgate/Frost Giant Megathread Mechabellum Monster Hunter Wilds
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
LiquidLegends to reintegrate into TL.net
Heroes of the Storm
Heroes of the Storm 2.0 Simple Questions, Simple Answers
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread Vape Nation Thread European Politico-economics QA Mega-thread
Fan Clubs
Maru Fan Club Serral Fan Club
Media & Entertainment
Korean Music Discussion [Manga] One Piece
Sports
2024 - 2025 Football Thread Formula 1 Discussion NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Cleaning My Mechanical Keyboard
TL Community
The Automated Ban List
Blogs
Cognitive styles x game perf…
TrAiDoS
StarCraft improvement
iopq
Heero Yuy & the Tax…
KrillinFromwales
I was completely wrong ab…
jameswatts
Need Your Help/Advice
Glider
Trip to the Zoo
micronesia
Poker
Nebuchad
Customize Sidebar...

Website Feedback

Closed Threads



Active: 19917 users

Math Puzzle - 7 Hats

Blogs > Slithe
Post a Reply
Normal
Slithe
Profile Blog Joined February 2007
United States985 Posts
Last Edited: 2010-09-09 22:38:34
September 09 2010 20:35 GMT
#1
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.


***
Leath
Profile Blog Joined July 2006
Canada1724 Posts
September 09 2010 20:39 GMT
#2
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.
http://www.kongregate.com/?referrer=Sagess
Pandain
Profile Blog Joined May 2010
United States12989 Posts
Last Edited: 2010-09-09 20:48:34
September 09 2010 20:48 GMT
#3
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.
seRapH
Profile Blog Joined April 2009
United States9756 Posts
September 09 2010 20:53 GMT
#4
i have a feeling that the answer isn't going to be one that'll make me go "OH THATS SMART" but rather "oh... -_-"
boomer hands
nitdkim
Profile Blog Joined March 2010
1264 Posts
September 09 2010 20:53 GMT
#5
you may have mixed up two different puzzles into one combo puzzle that doesn't make sense.
PM me if you want random korean images translated.
AcrossFiveJulys
Profile Blog Joined September 2005
United States3612 Posts
September 09 2010 20:53 GMT
#6
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.
Nytefish
Profile Blog Joined December 2007
United Kingdom4282 Posts
September 09 2010 20:54 GMT
#7
Are they allowed to agree on a timing system beforehand?
No I'm never serious.
seRapH
Profile Blog Joined April 2009
United States9756 Posts
September 09 2010 20:57 GMT
#8
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.
boomer hands
LunarDestiny
Profile Blog Joined August 2008
United States4177 Posts
September 09 2010 20:58 GMT
#9
Taking out all possible forms of loopholes, how can a 100% survival rate be achieved since they all could guess incorrectly.
tissue
Profile Joined April 2009
Malaysia441 Posts
Last Edited: 2010-09-09 21:04:50
September 09 2010 20:59 GMT
#10
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?
AcrossFiveJulys
Profile Blog Joined September 2005
United States3612 Posts
September 09 2010 21:02 GMT
#11
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.
Aesop
Profile Joined October 2007
Hungary11284 Posts
September 09 2010 21:05 GMT
#12
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?
ModeratorNon veritas sed auctoritas facit legem. | Liquipedia: Don't ask me, I'm retired.
Klive5ive
Profile Blog Joined January 2008
United Kingdom6056 Posts
September 09 2010 21:06 GMT
#13
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.
Don't hate the player - Hate the game
Slithe
Profile Blog Joined February 2007
United States985 Posts
September 09 2010 21:06 GMT
#14
I have updated the post with clarifications.

@tissue: They know the 7 possible colors
tissue
Profile Joined April 2009
Malaysia441 Posts
Last Edited: 2010-09-09 21:07:44
September 09 2010 21:06 GMT
#15
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.
AcrossFiveJulys
Profile Blog Joined September 2005
United States3612 Posts
September 09 2010 21:06 GMT
#16
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?
0nega
Profile Joined September 2010
Germany29 Posts
Last Edited: 2010-09-09 21:11:01
September 09 2010 21:07 GMT
#17
Hello!

lurked at this site for some time and couldn't resist EDIT but didn't have the solution... EDIT
seRapH
Profile Blog Joined April 2009
United States9756 Posts
September 09 2010 21:08 GMT
#18
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
boomer hands
Slithe
Profile Blog Joined February 2007
United States985 Posts
September 09 2010 21:09 GMT
#19
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

Impervious
Profile Blog Joined March 2009
Canada4198 Posts
September 09 2010 21:09 GMT
#20
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%.
~ \(ˌ)im-ˈpər-vē-əs\ : not capable of being damaged or harmed.
LeoTheLion
Profile Blog Joined July 2006
China958 Posts
Last Edited: 2010-09-09 21:11:28
September 09 2010 21:10 GMT
#21
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
Communism is not love. Communism is a hammer which we use to crush the enemy. -Chairman Mao
Aesop
Profile Joined October 2007
Hungary11284 Posts
September 09 2010 21:10 GMT
#22
kk, I get it, thanks for the explanations.
ModeratorNon veritas sed auctoritas facit legem. | Liquipedia: Don't ask me, I'm retired.
jiabung
Profile Blog Joined December 2007
United States720 Posts
September 09 2010 21:11 GMT
#23
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.
Slithe
Profile Blog Joined February 2007
United States985 Posts
September 09 2010 21:13 GMT
#24
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.
LunarDestiny
Profile Blog Joined August 2008
United States4177 Posts
September 09 2010 21:13 GMT
#25
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.
saltywet
Profile Blog Joined August 2009
Hong Kong1316 Posts
Last Edited: 2010-09-09 21:15:55
September 09 2010 21:14 GMT
#26
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.
Seth_
Profile Blog Joined July 2010
Belgium184 Posts
Last Edited: 2010-09-09 21:16:54
September 09 2010 21:14 GMT
#27
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??
The_Pacifist
Profile Blog Joined May 2010
United States540 Posts
September 09 2010 21:14 GMT
#28
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?
AcrossFiveJulys
Profile Blog Joined September 2005
United States3612 Posts
September 09 2010 21:18 GMT
#29
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.
Slithe
Profile Blog Joined February 2007
United States985 Posts
September 09 2010 21:19 GMT
#30
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.
tissue
Profile Joined April 2009
Malaysia441 Posts
September 09 2010 21:19 GMT
#31
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.
Darby.mcg
Profile Joined May 2010
United States16 Posts
Last Edited: 2010-09-09 21:22:36
September 09 2010 21:20 GMT
#32
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.
Klive5ive
Profile Blog Joined January 2008
United Kingdom6056 Posts
September 09 2010 21:21 GMT
#33
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.
Don't hate the player - Hate the game
Slithe
Profile Blog Joined February 2007
United States985 Posts
September 09 2010 21:21 GMT
#34
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.
revy
Profile Joined September 2009
United States1524 Posts
September 09 2010 21:21 GMT
#35
The prisoners certainly get to talk beforehand and setup a strategy but they can't show it to other prisoners.
Black Gun
Profile Blog Joined July 2009
Germany4482 Posts
Last Edited: 2010-09-09 21:24:49
September 09 2010 21:24 GMT
#36
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?
"What am I supposed to do against this?" - "Lose!" :-]
Phant
Profile Joined August 2010
United States737 Posts
September 09 2010 21:26 GMT
#37
Everyone writes the same color?
The_Pacifist
Profile Blog Joined May 2010
United States540 Posts
Last Edited: 2010-09-09 21:28:20
September 09 2010 21:27 GMT
#38
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.
AcrossFiveJulys
Profile Blog Joined September 2005
United States3612 Posts
September 09 2010 21:27 GMT
#39
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.
getSome[703]
Profile Blog Joined December 2009
United States753 Posts
September 09 2010 21:27 GMT
#40
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
Running Log! http://www.runningahead.com/logs/5081b4d7a4a94c5e8fa20b01e668dfb6/calendar
Black Gun
Profile Blog Joined July 2009
Germany4482 Posts
September 09 2010 21:28 GMT
#41
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...
"What am I supposed to do against this?" - "Lose!" :-]
popnfreshspk
Profile Blog Joined September 2007
United States93 Posts
Last Edited: 2010-09-09 21:31:27
September 09 2010 21:28 GMT
#42
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.
hey you
Stenstyren
Profile Blog Joined April 2010
Sweden619 Posts
September 09 2010 21:28 GMT
#43
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...
Seth_
Profile Blog Joined July 2010
Belgium184 Posts
Last Edited: 2010-09-09 21:31:45
September 09 2010 21:30 GMT
#44
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.
The_Pacifist
Profile Blog Joined May 2010
United States540 Posts
September 09 2010 21:30 GMT
#45
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.
Klive5ive
Profile Blog Joined January 2008
United Kingdom6056 Posts
September 09 2010 21:30 GMT
#46
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.
Don't hate the player - Hate the game
tissue
Profile Joined April 2009
Malaysia441 Posts
September 09 2010 21:31 GMT
#47
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
AcrossFiveJulys
Profile Blog Joined September 2005
United States3612 Posts
September 09 2010 21:31 GMT
#48
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.
Black Gun
Profile Blog Joined July 2009
Germany4482 Posts
September 09 2010 21:31 GMT
#49
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...
"What am I supposed to do against this?" - "Lose!" :-]
LunarDestiny
Profile Blog Joined August 2008
United States4177 Posts
September 09 2010 21:32 GMT
#50
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?
Klive5ive
Profile Blog Joined January 2008
United Kingdom6056 Posts
September 09 2010 21:32 GMT
#51
How about where they sit? Can they choose where they sit AFTER they have seen each others hats?
Don't hate the player - Hate the game
The_Pacifist
Profile Blog Joined May 2010
United States540 Posts
September 09 2010 21:33 GMT
#52
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.
Slithe
Profile Blog Joined February 2007
United States985 Posts
September 09 2010 21:34 GMT
#53
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.
Seth_
Profile Blog Joined July 2010
Belgium184 Posts
September 09 2010 21:35 GMT
#54
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.

BottleAbuser
Profile Blog Joined December 2007
Korea (South)1888 Posts
September 09 2010 21:35 GMT
#55
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.
Compilers are like boyfriends, you miss a period and they go crazy on you.
Slithe
Profile Blog Joined February 2007
United States985 Posts
September 09 2010 21:36 GMT
#56
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.
Nytefish
Profile Blog Joined December 2007
United Kingdom4282 Posts
September 09 2010 21:37 GMT
#57
Do they all have to hand their answer into the king at the same time, or can they go one by one?
No I'm never serious.
Klive5ive
Profile Blog Joined January 2008
United Kingdom6056 Posts
September 09 2010 21:37 GMT
#58
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?
Don't hate the player - Hate the game
jiabung
Profile Blog Joined December 2007
United States720 Posts
September 09 2010 21:38 GMT
#59
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.
saltywet
Profile Blog Joined August 2009
Hong Kong1316 Posts
September 09 2010 21:40 GMT
#60
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
Happy.fairytail
Profile Blog Joined May 2010
United States327 Posts
September 09 2010 21:40 GMT
#61
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
Black Gun
Profile Blog Joined July 2009
Germany4482 Posts
September 09 2010 21:41 GMT
#62
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
"What am I supposed to do against this?" - "Lose!" :-]
BottleAbuser
Profile Blog Joined December 2007
Korea (South)1888 Posts
September 09 2010 21:41 GMT
#63
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.
Compilers are like boyfriends, you miss a period and they go crazy on you.
Slithe
Profile Blog Joined February 2007
United States985 Posts
Last Edited: 2010-09-09 21:44:54
September 09 2010 21:41 GMT
#64
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


Black Gun
Profile Blog Joined July 2009
Germany4482 Posts
September 09 2010 21:43 GMT
#65
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.
"What am I supposed to do against this?" - "Lose!" :-]
Slithe
Profile Blog Joined February 2007
United States985 Posts
September 09 2010 21:44 GMT
#66
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.
tofucake
Profile Blog Joined October 2009
Hyrule19026 Posts
September 09 2010 21:44 GMT
#67
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.
Liquipediaasante sana squash banana
Impervious
Profile Blog Joined March 2009
Canada4198 Posts
Last Edited: 2010-09-09 21:51:53
September 09 2010 21:45 GMT
#68
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.....
~ \(ˌ)im-ˈpər-vē-əs\ : not capable of being damaged or harmed.
tissue
Profile Joined April 2009
Malaysia441 Posts
September 09 2010 21:45 GMT
#69
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
AyeH
Profile Blog Joined March 2010
United States534 Posts
September 09 2010 21:46 GMT
#70
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.
Is it in you?
saltywet
Profile Blog Joined August 2009
Hong Kong1316 Posts
September 09 2010 21:47 GMT
#71
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?
CanucksJC
Profile Blog Joined August 2010
Canada1241 Posts
September 09 2010 21:47 GMT
#72
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.
UBC StarCraft Club is official @ UBC Vancouver campus! Your first eSport community on campus. Welcomes players of all levels at UBC. Follow us on facebook page: http://www.facebook.com/home.php#!/group.php?gid=155630424470014 or IRC @ irc.rizon.net #ubcsc
Slithe
Profile Blog Joined February 2007
United States985 Posts
September 09 2010 21:48 GMT
#73
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.
LunarDestiny
Profile Blog Joined August 2008
United States4177 Posts
September 09 2010 21:48 GMT
#74
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.
Seth_
Profile Blog Joined July 2010
Belgium184 Posts
September 09 2010 21:49 GMT
#75
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.
Slithe
Profile Blog Joined February 2007
United States985 Posts
September 09 2010 21:49 GMT
#76
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.
BottleAbuser
Profile Blog Joined December 2007
Korea (South)1888 Posts
September 09 2010 21:53 GMT
#77
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.
Compilers are like boyfriends, you miss a period and they go crazy on you.
KarlSberg~
Profile Blog Joined September 2003
731 Posts
Last Edited: 2010-09-09 21:56:07
September 09 2010 21:54 GMT
#78
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.
There are 01 kind of people who know binary. Those who understand little endian and those who don t.
tofucake
Profile Blog Joined October 2009
Hyrule19026 Posts
September 09 2010 21:54 GMT
#79
I have the answer
+ Show Spoiler +
+ Show Spoiler +
+ Show Spoiler +
+ Show Spoiler +
+ Show Spoiler +
+ Show Spoiler +
+ Show Spoiler +
+ Show Spoiler +
It's not possible.
Liquipediaasante sana squash banana
tissue
Profile Joined April 2009
Malaysia441 Posts
September 09 2010 21:55 GMT
#80
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?
tofucake
Profile Blog Joined October 2009
Hyrule19026 Posts
September 09 2010 21:56 GMT
#81
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.
Liquipediaasante sana squash banana
tofucake
Profile Blog Joined October 2009
Hyrule19026 Posts
September 09 2010 21:56 GMT
#82
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.
Liquipediaasante sana squash banana
BottleAbuser
Profile Blog Joined December 2007
Korea (South)1888 Posts
September 09 2010 21:56 GMT
#83
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.
Compilers are like boyfriends, you miss a period and they go crazy on you.
Slithe
Profile Blog Joined February 2007
United States985 Posts
September 09 2010 21:57 GMT
#84
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.
Trump
Profile Joined April 2010
United States350 Posts
September 09 2010 21:57 GMT
#85
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)
Friendship is Magic! <3
KarlSberg~
Profile Blog Joined September 2003
731 Posts
September 09 2010 21:57 GMT
#86
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?
There are 01 kind of people who know binary. Those who understand little endian and those who don t.
Slithe
Profile Blog Joined February 2007
United States985 Posts
September 09 2010 21:57 GMT
#87
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.
tofucake
Profile Blog Joined October 2009
Hyrule19026 Posts
September 09 2010 21:58 GMT
#88
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.
Liquipediaasante sana squash banana
LeoTheLion
Profile Blog Joined July 2006
China958 Posts
Last Edited: 2010-09-09 22:23:24
September 09 2010 22:00 GMT
#89
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.
Communism is not love. Communism is a hammer which we use to crush the enemy. -Chairman Mao
The_Pacifist
Profile Blog Joined May 2010
United States540 Posts
September 09 2010 22:00 GMT
#90
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.
tofucake
Profile Blog Joined October 2009
Hyrule19026 Posts
Last Edited: 2010-09-09 22:02:06
September 09 2010 22:00 GMT
#91
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
Liquipediaasante sana squash banana
Lark
Profile Joined December 2009
United States24 Posts
September 09 2010 22:02 GMT
#92
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.
KarlSberg~
Profile Blog Joined September 2003
731 Posts
September 09 2010 22:02 GMT
#93
@Tofucake
The first one is possible, 7 colors are announced but not all of them have to be present in the actual set.
There are 01 kind of people who know binary. Those who understand little endian and those who don t.
KazeHydra
Profile Blog Joined August 2010
Japan2788 Posts
Last Edited: 2010-09-09 22:06:03
September 09 2010 22:03 GMT
#94
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.
"Because I know this promise that won’t disappear will turn even a cause of tears into strength. You taught me that if I can believe, there is nothing that cannot come true." - Nana Mizuki (Yakusoku) 17:36 ils kaze got me into nana 17:36 ils by his blog
Pufftrees
Profile Joined March 2009
2449 Posts
September 09 2010 22:04 GMT
#95
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
Chance favors the prepared mind.
Lark
Profile Joined December 2009
United States24 Posts
September 09 2010 22:05 GMT
#96
@Kaze

They each guess individually, otherwise that would be communicating.
Seth_
Profile Blog Joined July 2010
Belgium184 Posts
September 09 2010 22:05 GMT
#97
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 +
modulo 2
in the 2-player solution.

The next challenge: prove that the solution by KarlSberg is correct :-)
Slithe
Profile Blog Joined February 2007
United States985 Posts
Last Edited: 2010-09-09 22:10:51
September 09 2010 22:07 GMT
#98
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.
madnessman
Profile Blog Joined May 2009
United States1581 Posts
September 09 2010 22:07 GMT
#99
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.
LastPrime
Profile Blog Joined May 2010
United States109 Posts
September 09 2010 22:11 GMT
#100
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.
saltywet
Profile Blog Joined August 2009
Hong Kong1316 Posts
September 09 2010 22:12 GMT
#101
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
BottleAbuser
Profile Blog Joined December 2007
Korea (South)1888 Posts
September 09 2010 22:13 GMT
#102
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.
Compilers are like boyfriends, you miss a period and they go crazy on you.
Nytefish
Profile Blog Joined December 2007
United Kingdom4282 Posts
Last Edited: 2010-09-09 22:14:51
September 09 2010 22:14 GMT
#103
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.
No I'm never serious.
Lark
Profile Joined December 2009
United States24 Posts
September 09 2010 22:14 GMT
#104
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...
BottleAbuser
Profile Blog Joined December 2007
Korea (South)1888 Posts
September 09 2010 22:15 GMT
#105
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.
Compilers are like boyfriends, you miss a period and they go crazy on you.
Slithe
Profile Blog Joined February 2007
United States985 Posts
September 09 2010 22:16 GMT
#106
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.
Logo
Profile Blog Joined April 2010
United States7542 Posts
Last Edited: 2010-09-09 22:19:36
September 09 2010 22:18 GMT
#107
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.
Logo
Impervious
Profile Blog Joined March 2009
Canada4198 Posts
September 09 2010 22:23 GMT
#108
Damn, that is actually pretty simple.....
~ \(ˌ)im-ˈpər-vē-əs\ : not capable of being damaged or harmed.
jalstar
Profile Blog Joined September 2009
United States8198 Posts
September 09 2010 22:25 GMT
#109
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.
saltywet
Profile Blog Joined August 2009
Hong Kong1316 Posts
Last Edited: 2010-09-09 22:31:10
September 09 2010 22:28 GMT
#110
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
The_Pacifist
Profile Blog Joined May 2010
United States540 Posts
Last Edited: 2010-09-09 22:30:47
September 09 2010 22:29 GMT
#111
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.
gondolin
Profile Blog Joined September 2007
France332 Posts
September 09 2010 22:30 GMT
#112
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
jalstar
Profile Blog Joined September 2009
United States8198 Posts
September 09 2010 22:31 GMT
#113
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.
Slithe
Profile Blog Joined February 2007
United States985 Posts
September 09 2010 22:32 GMT
#114
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.
saltywet
Profile Blog Joined August 2009
Hong Kong1316 Posts
September 09 2010 22:32 GMT
#115
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
djcube
Profile Blog Joined July 2009
United States985 Posts
September 09 2010 22:33 GMT
#116
I'm probably not understanding the solution, but how does each prisoner know what number to label himself if they cannot communicate?
LeoTheLion
Profile Blog Joined July 2006
China958 Posts
Last Edited: 2010-09-09 22:34:56
September 09 2010 22:33 GMT
#117
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
Communism is not love. Communism is a hammer which we use to crush the enemy. -Chairman Mao
Glull
Profile Blog Joined November 2009
Germany404 Posts
September 09 2010 22:33 GMT
#118
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.
Slithe
Profile Blog Joined February 2007
United States985 Posts
September 09 2010 22:36 GMT
#119
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.
Logo
Profile Blog Joined April 2010
United States7542 Posts
September 09 2010 22:36 GMT
#120
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.
Logo
Muff2n
Profile Blog Joined March 2009
United Kingdom250 Posts
September 09 2010 22:37 GMT
#121
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.
Slithe
Profile Blog Joined February 2007
United States985 Posts
Last Edited: 2010-09-09 22:40:53
September 09 2010 22:37 GMT
#122
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.
gondolin
Profile Blog Joined September 2007
France332 Posts
Last Edited: 2010-09-09 23:03:47
September 09 2010 22:40 GMT
#123
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.
Happy.fairytail
Profile Blog Joined May 2010
United States327 Posts
Last Edited: 2010-09-09 22:46:03
September 09 2010 22:43 GMT
#124
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...
Slithe
Profile Blog Joined February 2007
United States985 Posts
September 09 2010 22:47 GMT
#125
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
saltywet
Profile Blog Joined August 2009
Hong Kong1316 Posts
September 09 2010 22:48 GMT
#126
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
BottleAbuser
Profile Blog Joined December 2007
Korea (South)1888 Posts
Last Edited: 2010-09-09 22:52:03
September 09 2010 22:49 GMT
#127
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.
Compilers are like boyfriends, you miss a period and they go crazy on you.
silveryms
Profile Joined January 2010
United States23 Posts
Last Edited: 2010-09-09 23:22:55
September 09 2010 22:55 GMT
#128
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!
Slithe
Profile Blog Joined February 2007
United States985 Posts
September 09 2010 22:55 GMT
#129
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
tofucake
Profile Blog Joined October 2009
Hyrule19026 Posts
Last Edited: 2010-09-09 23:02:42
September 09 2010 23:02 GMT
#130
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.
Liquipediaasante sana squash banana
Phant
Profile Joined August 2010
United States737 Posts
September 09 2010 23:06 GMT
#131
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.
Slithe
Profile Blog Joined February 2007
United States985 Posts
September 09 2010 23:11 GMT
#132
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?
BottleAbuser
Profile Blog Joined December 2007
Korea (South)1888 Posts
Last Edited: 2010-09-09 23:20:55
September 09 2010 23:20 GMT
#133
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.)
Compilers are like boyfriends, you miss a period and they go crazy on you.
Phant
Profile Joined August 2010
United States737 Posts
Last Edited: 2010-09-09 23:54:15
September 09 2010 23:47 GMT
#134
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
Muff2n
Profile Blog Joined March 2009
United Kingdom250 Posts
September 10 2010 06:41 GMT
#135
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)
garbanzo
Profile Joined October 2009
United States4046 Posts
Last Edited: 2010-09-10 16:56:06
September 10 2010 16:54 GMT
#136
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?
Even during difficult times, when I sat down to play the game, there were times where it felt like god has descended down and played [for me].
Normal
Please log in or register to reply.
Live Events Refresh
BSL 2v2 ProLeague
19:00
Day 4
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
mouzHeroMarine 627
BRAT_OK 132
JuggernautJason58
MindelVK 32
ForJumy 19
StarCraft: Brood War
Britney 24206
TY 146
ZZZero.O 146
firebathero 131
Dewaltoss 118
Snow 62
JYJ30
Dota 2
Pyrionflax124
Counter-Strike
fl0m6898
Stewie2K631
Super Smash Bros
C9.Mang0988
Mew2King72
Heroes of the Storm
Grubby2580
Other Games
FrodaN1069
Beastyqt770
B2W.Neo641
Trikslyr77
KnowMe73
ZombieGrub65
mouzStarbuck21
Organizations
Dota 2
PGL Dota 2 - Secondary Stream1433
Other Games
BasetradeTV73
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 20 non-featured ]
StarCraft 2
• kabyraGe 252
• StrangeGG 49
• davetesta27
• Hupsaiya 15
• LaughNgamezSOOP
• AfreecaTV YouTube
• sooper7s
• intothetv
• Kozan
• Migwel
• IndyKCrew
StarCraft: Brood War
• FirePhoenix6
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota21119
• Ler152
League of Legends
• TFBlade1813
• Shiphtur780
Other Games
• imaqtpie1079
Upcoming Events
Replay Cast
4h 19m
CranKy Ducklings
14h 19m
Bellum Gens Elite
14h 19m
SC Evo League
16h 19m
Fire Grow Cup
19h 19m
CSO Contender
21h 19m
BSL: ProLeague
22h 19m
StRyKeR vs MadiNho
Cross vs UltrA
TT1 vs JDConan
Bonyth vs Sziky
ZZZero.O139
Replay Cast
1d 4h
SOOP Global
1d 7h
Creator vs Rogue
Cure vs Classic
SOOP
1d 13h
Classic vs GuMiho
[ Show More ]
Sparkling Tuna Cup
1d 14h
AllThingsProtoss
1d 15h
Fire Grow Cup
1d 19h
BSL: ProLeague
1d 22h
HBO vs Doodle
spx vs Tech
DragOn vs Hawk
Dewalt vs TerrOr
Replay Cast
2 days
Replay Cast
3 days
Replay Cast
3 days
WardiTV Invitational
3 days
WardiTV Invitational
3 days
GSL Code S
4 days
Rogue vs GuMiho
Maru vs Solar
Replay Cast
5 days
GSL Code S
5 days
herO vs TBD
Classic vs TBD
The PondCast
5 days
Replay Cast
6 days
GSL Code S
6 days
WardiTV Invitational
6 days
Liquipedia Results

Completed

CSL Season 17: Qualifier 1
DreamHack Dallas 2025
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
BSL Season 20
KCM Race Survival 2025 Season 2
NPSL S3
Rose Open S1
CSL Season 17: Qualifier 2
2025 GSL S2
BGE Stara Zagora 2025
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
ECL Season 49: Europe
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025
YaLLa Compass Qatar 2025
PGL Bucharest 2025
BLAST Open Spring 2025

Upcoming

CSL 17: 2025 SUMMER
Copa Latinoamericana 4
CSLPRO Last Chance 2025
CSLPRO Chat StarLAN 3
K-Championship
SEL Season 2 Championship
Esports World Cup 2025
HSC XXVII
Championship of Russia 2025
Murky Cup #2
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.