• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 00:31
CET 06:31
KST 14:31
  • 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 Canada1SC: Evo Complete - Ranked Ladder OPEN ALPHA2StarCraft, SC2, HotS, WC3, Returning to Blizzcon!45$5,000+ WardiTV 2025 Championship7[BSL21] RO32 Group Stage4
StarCraft 2
General
Weekly Cups (Nov 3-9): Clem Conquers in Canada Mech is the composition that needs teleportation t Craziest Micro Moments Of All Time? SC: Evo Complete - Ranked Ladder OPEN ALPHA RotterdaM "Serral is the GOAT, and it's not close"
Tourneys
Constellation Cup - Main Event - Stellar Fest Tenacious Turtle Tussle Sparkling Tuna Cup - Weekly Open Tournament $5,000+ WardiTV 2025 Championship Merivale 8 Open - LAN - Stellar Fest
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 FlaSh on: Biggest Problem With SnOw's Playstyle BGH Auto Balance -> http://bghmmr.eu/ [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
Current Meta PvZ map balance How to stay on top of macro? Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Should offensive tower rushing be viable in RTS games? 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
Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine US Politics Mega-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
Dyadica Gospel – a Pulp No…
Hildegard
Coffee x Performance in Espo…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Reality "theory" prov…
perfectspheres
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1773 users

Math Puzzle - 7 Hats - Page 5

Blogs > Slithe
Post a Reply
Prev 1 2 3 4 5 6 7 Next All
tofucake
Profile Blog Joined October 2009
Hyrule19151 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
Hyrule19151 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
Hyrule19151 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
Hyrule19151 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.
Prev 1 2 3 4 5 6 7 Next All
Please log in or register to reply.
Live Events Refresh
Next event in 6h 29m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RuFF_SC2 178
StarCraft: Brood War
Britney 32876
Shuttle 896
Tasteless 193
Noble 29
Icarus 12
Dota 2
NeuroSwarm79
Counter-Strike
Coldzera 506
Super Smash Bros
hungrybox419
Other Games
summit1g15591
JimRising 543
C9.Mang097
Organizations
Other Games
gamesdonequick1120
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• Berry_CruncH127
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Scarra1576
• Stunt464
Upcoming Events
WardiTV Korean Royale
6h 29m
OSC
11h 29m
Replay Cast
17h 29m
Replay Cast
1d 3h
Kung Fu Cup
1d 6h
Classic vs Solar
herO vs Cure
Reynor vs GuMiho
ByuN vs ShoWTimE
Tenacious Turtle Tussle
1d 17h
The PondCast
2 days
RSL Revival
2 days
Solar vs Zoun
MaxPax vs Bunny
Kung Fu Cup
2 days
WardiTV Korean Royale
2 days
[ Show More ]
PiGosaur Monday
2 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.