• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 07:39
CET 13:39
KST 21:39
  • 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
RSL Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
Weekly Cups (Dec 15-21): Classic wins big, MaxPax & Clem take weeklies0ComeBackTV's documentary on Byun's Career !10Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win4Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump1Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2
StarCraft 2
General
Weekly Cups (Dec 15-21): Classic wins big, MaxPax & Clem take weeklies ComeBackTV's documentary on Byun's Career ! Micro Lags When Playing SC2? When will we find out if there are more tournament Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win
Tourneys
$5,000+ WardiTV 2025 Championship Sparkling Tuna Cup - Weekly Open Tournament $100 Prize Pool - Winter Warp Gate Masters Showdow Winter Warp Gate Amateur Showdown #1 RSL Offline Finals Info - Dec 13 and 14!
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 505 Rise From Ashes Mutation # 504 Retribution Mutation # 503 Fowl Play Mutation # 502 Negative Reinforcement
Brood War
General
Klaucher discontinued / in-game color settings BGH Auto Balance -> http://bghmmr.eu/ Anyone remember me from 2000s Bnet EAST server? How Rain Became ProGamer in Just 3 Months FlaSh on: Biggest Problem With SnOw's Playstyle
Tourneys
[BSL21] LB QuarterFinals - Sunday 21:00 CET Small VOD Thread 2.0 [Megathread] Daily Proleagues [BSL21] WB SEMIFINALS - Saturday 21:00 CET
Strategy
Simple Questions, Simple Answers Game Theory for Starcraft Current Meta Fighting Spirit mining rates
Other Games
General Games
Stormgate/Frost Giant Megathread Beyond All Reason Path of Exile General RTS Discussion Thread Nintendo Switch Thread
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
Mafia Game Mode Feedback/Ideas Survivor II: The Amazon Sengoku Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread The Games Industry And ATVI Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine YouTube Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
TL+ Announced Where to ask questions and add stream?
Blogs
The (Hidden) Drug Problem in…
TrAiDoS
I decided to write a webnov…
DjKniteX
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1613 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
Hyrule19180 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
Hyrule19180 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
Hyrule19180 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
Hyrule19180 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
Wardi Open
12:00
Monday #66
WardiTV725
Liquipedia
Replay Cast
09:00
WardiTV Mondays #65
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Lowko202
RotterdaM 172
BRAT_OK 116
trigger 28
StarCraft: Brood War
Sea 2278
Bisu 1559
Stork 701
GuemChi 601
Larva 542
Soma 436
firebathero 387
Mini 342
Light 335
ggaemo 258
[ Show more ]
Snow 172
Sharp 162
PianO 147
hero 140
Sea.KH 122
Killer 116
Aegong 96
Mong 95
Pusan 84
Rush 78
JYJ 66
ToSsGirL 58
Movie 43
soO 39
sorry 37
Shinee 25
zelot 25
NotJumperer 24
ajuk12(nOOB) 23
910 22
yabsab 19
Terrorterran 19
Noble 14
Sacsri 13
SilentControl 11
Bale 7
Dota 2
singsing4265
XcaliburYe616
Counter-Strike
olofmeister2816
zeus1061
x6flipin865
oskar79
Heroes of the Storm
Khaldor182
Other Games
summit1g7982
Fuzer 315
crisheroes290
Mew2King58
nookyyy 44
Organizations
StarCraft: Brood War
lovetv 5
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• StrangeGG 72
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Stunt460
Other Games
• WagamamaTV300
Upcoming Events
Monday Night Weeklies
4h 21m
WardiTV Invitational
1d 23h
Replay Cast
2 days
WardiTV Invitational
2 days
ByuN vs Solar
Clem vs Classic
Cure vs herO
Reynor vs MaxPax
Replay Cast
4 days
Sparkling Tuna Cup
5 days
Replay Cast
6 days
Wardi Open
6 days
Liquipedia Results

Completed

YSL S2
WardiTV 2025
META Madness #9

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
BSL Season 21
Slon Tour Season 2
CSL Season 19: Qualifier 2
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22

Upcoming

CSL 2025 WINTER (S19)
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Big Gabe Cup #3
OSC Championship Season 13
Nations Cup 2026
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
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.