• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 16:32
CET 22:32
KST 06:32
  • 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
TL.net Map Contest #21: Winners11Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13TL.net Map Contest #21: Voting12[ASL20] Ro4 Preview: Descent11
Community News
Weekly Cups (Nov 3-9): Clem Conquers in Canada0SC: Evo Complete - Ranked Ladder OPEN ALPHA1StarCraft, SC2, HotS, WC3, Returning to Blizzcon!45$5,000+ WardiTV 2025 Championship7[BSL21] RO32 Group Stage4
StarCraft 2
General
Mech is the composition that needs teleportation t Weekly Cups (Nov 3-9): Clem Conquers in Canada RotterdaM "Serral is the GOAT, and it's not close" SC: Evo Complete - Ranked Ladder OPEN ALPHA TL.net Map Contest #21: Winners
Tourneys
Constellation Cup - Main Event - Stellar Fest Sparkling Tuna Cup - Weekly Open Tournament $5,000+ WardiTV 2025 Championship Merivale 8 Open - LAN - Stellar Fest Sea Duckling Open (Global, Bronze-Diamond)
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened Mutation # 496 Endless Infection
Brood War
General
BW General Discussion BGH Auto Balance -> http://bghmmr.eu/ FlaSh on: Biggest Problem With SnOw's Playstyle [ASL20] Ask the mapmakers — Drop your questions Where's CardinalAllin/Jukado the mapmaker?
Tourneys
[Megathread] Daily Proleagues [ASL20] Grand Finals [BSL21] RO32 Group A - Saturday 21:00 CET [BSL21] RO32 Group B - Sunday 21:00 CET
Strategy
PvZ map balance Current Meta How to stay on top of macro? Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Stormgate/Frost Giant Megathread Should offensive tower rushing be viable in RTS games? Nintendo Switch Thread Path of Exile Dawn of War IV
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread Canadian Politics Mega-thread The Games Industry And ATVI
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
[Manga] One Piece Anime Discussion Thread Movie Discussion! Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Learning my new SC2 hotkey…
Hildegard
Coffee x Performance in Espo…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Reality "theory" prov…
perfectspheres
Our Last Hope in th…
KrillinFromwales
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1428 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 States9776 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 States9776 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
Hungary11304 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 States9776 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
Canada4211 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
Next event in 1h 29m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
UpATreeSC 255
JuggernautJason115
BRAT_OK 69
Railgan 63
ForJumy 40
StarCraft: Brood War
Rain 2477
Horang2 714
Shuttle 574
Free 75
NaDa 21
League of Legends
rGuardiaN48
Counter-Strike
fl0m1400
Heroes of the Storm
Liquid`Hasu552
Other Games
Grubby5186
FrodaN1669
Beastyqt914
shahzam437
Pyrionflax187
ArmadaUGS93
Mew2King75
Trikslyr69
ZombieGrub60
Maynarde25
Organizations
Other Games
BasetradeTV90
Algost 5
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• Hupsaiya 51
• Adnapsc2 23
• davetesta7
• Dystopia_ 2
• IndyKCrew
• sooper7s
• AfreecaTV YouTube
• Migwel
• intothetv
• LaughNgamezSOOP
• Kozan
StarCraft: Brood War
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
League of Legends
• imaqtpie2987
• TFBlade1043
Other Games
• WagamamaTV393
• Shiphtur320
Upcoming Events
Replay Cast
1h 29m
WardiTV Korean Royale
14h 29m
OSC
19h 29m
Replay Cast
1d 1h
Replay Cast
1d 11h
Kung Fu Cup
1d 14h
Classic vs Solar
herO vs Cure
Reynor vs GuMiho
ByuN vs ShoWTimE
Tenacious Turtle Tussle
2 days
The PondCast
2 days
RSL Revival
2 days
Solar vs Zoun
MaxPax vs Bunny
Kung Fu Cup
2 days
[ Show More ]
WardiTV Korean Royale
2 days
PiGosaur Monday
3 days
RSL Revival
3 days
Classic vs Creator
Cure vs TriGGeR
Kung Fu Cup
3 days
CranKy Ducklings
4 days
RSL Revival
4 days
herO vs Gerald
ByuN vs SHIN
Kung Fu Cup
4 days
BSL 21
4 days
Tarson vs Julia
Doodle vs OldBoy
eOnzErG vs WolFix
StRyKeR vs Aeternum
Sparkling Tuna Cup
5 days
RSL Revival
5 days
Reynor vs sOs
Maru vs Ryung
Kung Fu Cup
5 days
WardiTV Korean Royale
5 days
BSL 21
5 days
JDConan vs Semih
Dragon vs Dienmax
Tech vs NewOcean
TerrOr vs Artosis
Wardi Open
6 days
Monday Night Weeklies
6 days
Liquipedia Results

Completed

Proleague 2025-11-07
Stellar Fest: Constellation Cup
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
BSL Season 21
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual

Upcoming

SLON Tour Season 2
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
RSL Revival: Season 3
META Madness #9
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
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.