• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 20:27
CEST 02:27
KST 09:27
  • 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 & Preview20Code 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 & Dates6GSL 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
BGE Stara Zagora 2025: Info & Preview Magnus Carlsen and Fabi review Clem's chess game. Jim claims he and Firefly were involved in match-fixing GSL Ro4 and Finals moved to Sunday June 15th Serious Question: Mech
Tourneys
Bellum Gens Elite: Stara Zagora 2025 SOOPer7s Showmatches 2025 Cheeseadelphia 2025 - Open Bracket LAN! $25,000+ WardiTV 2025 Series Sparkling Tuna Cup - Weekly Open Tournament
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
[BSL20] ProLeague: Bracket Stage & Dates BW General Discussion Will foreigners ever be able to challenge Koreans? BGH auto balance -> http://bghmmr.eu/ I made an ASL quiz
Tourneys
[BSL 2v2] ProLeague Season 3 - Friday 21:00 CET [ASL19] Grand Finals [Megathread] Daily Proleagues Small VOD Thread 2.0
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
Nintendo Switch Thread Mechabellum Stormgate/Frost Giant Megathread Monster Hunter Wilds Path of Exile
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
Vanilla Mini Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine 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
Heero Yuy & the Tax…
KrillinFromwales
Research study on team perfo…
TrAiDoS
I was completely wrong ab…
jameswatts
Need Your Help/Advice
Glider
Trip to the Zoo
micronesia
Poker
Nebuchad
Info SLEgma_12
SLEgma_12
Customize Sidebar...

Website Feedback

Closed Threads



Active: 19295 users

Math Puzzle - 7 Hats

Blogs > Slithe
Post a Reply
1 2 3 4 5 6 7 Next All
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.
1 2 3 4 5 6 7 Next All
Please log in or register to reply.
Live Events Refresh
OSC
00:00
OSC Elite Rising Star #15
NightPhoenix vs HiGhDrALIVE!
Jumy vs TBD
Percival vs sebesdes
PAPI vs MilkiCow
YoungYakov vs TBD
ArT vs ReBellioN
xJustxJordanx1
Liquipedia
Replay Cast
00:00
StarCraft Evolution League #12
CranKy Ducklings86
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
NeuroSwarm 198
Livibee 59
Vindicta 19
StarCraft: Brood War
Artosis 810
Backho 25
910 25
Icarus 5
Dota 2
LuMiX0
League of Legends
JimRising 579
Counter-Strike
Fnx 1914
taco 364
Foxcn277
Super Smash Bros
C9.Mang0643
hungrybox465
Other Games
summit1g10901
shahzam1242
ViBE264
KnowMe32
PPMD28
Organizations
Other Games
gamesdonequick810
BasetradeTV78
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• Berry_CruncH301
• davetesta71
• HeavenSC 17
• Migwel
• AfreecaTV YouTube
• sooper7s
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
StarCraft: Brood War
• RayReign 24
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota22633
League of Legends
• Doublelift5585
Other Games
• Scarra1312
• imaqtpie1201
Upcoming Events
Bellum Gens Elite
9h 33m
WardiTV Invitational
13h 33m
BSL 2v2 ProLeague
18h 33m
Replay Cast
23h 33m
CranKy Ducklings
1d 9h
SC Evo League
1d 11h
Bellum Gens Elite
1d 12h
Fire Grow Cup
1d 14h
CSO Contender
1d 16h
BSL: ProLeague
1d 17h
StRyKeR vs MadiNho
Cross vs UltrA
TT1 vs JDConan
Bonyth vs Sziky
[ Show More ]
Replay Cast
1d 23h
SOOP Global
2 days
Creator vs Rogue
Cure vs Classic
SOOP
2 days
Classic vs GuMiho
Sparkling Tuna Cup
2 days
AllThingsProtoss
2 days
Fire Grow Cup
2 days
BSL: ProLeague
2 days
HBO vs Doodle
spx vs Tech
DragOn vs Hawk
Dewalt vs TerrOr
Replay Cast
2 days
Replay Cast
3 days
Replay Cast
4 days
WardiTV Invitational
4 days
WardiTV Invitational
4 days
GSL Code S
5 days
Rogue vs GuMiho
Maru vs Solar
Replay Cast
5 days
GSL Code S
6 days
herO vs TBD
Classic vs TBD
The PondCast
6 days
Replay Cast
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
NC Random Cup
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.