• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 14:05
CET 19:05
KST 03:05
  • 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
ByuL: The Forgotten Master of ZvT30Behind the Blue - Team Liquid History Book19Clem wins HomeStory Cup 289HomeStory Cup 28 - Info & Preview13Rongyi Cup S3 - Preview & Info8
Community News
Weekly Cups (March 9-15): herO, Clem, ByuN win02026 KungFu Cup Announcement5BGE Stara Zagora 2026 cancelled12Blizzard Classic Cup - Tastosis announced as captains17Weekly Cups (March 2-8): ByuN overcomes PvT block4
StarCraft 2
General
Potential Updates Coming to the SC2 CN Server Blizzard Classic Cup - Tastosis announced as captains Weekly Cups (March 9-15): herO, Clem, ByuN win GSL CK - New online series BGE Stara Zagora 2026 cancelled
Tourneys
2026 KungFu Cup Announcement [GSL CK] #2: Team Classic vs. Team Solar [GSL CK] #1: Team Maru vs. Team herO RSL Season 4 announced for March-April PIG STY FESTIVAL 7.0! (19 Feb - 1 Mar)
Strategy
Custom Maps
Publishing has been re-enabled! [Feb 24th 2026] Map Editor closed ?
External Content
The PondCast: SC2 News & Results Mutation # 517 Distant Threat Mutation # 516 Specter of Death Mutation # 515 Together Forever
Brood War
General
ASL21 General Discussion BGH Auto Balance -> http://bghmmr.eu/ Gypsy to Korea BSL 22 Map Contest — Submissions OPEN to March 10 Are you ready for ASL 21? Hype VIDEO
Tourneys
ASL Season 21 Qualifiers March 7-8 [Megathread] Daily Proleagues [BSL22] Open Qualifiers & Ladder Tours IPSL Spring 2026 is here!
Strategy
Simple Questions, Simple Answers Soma's 9 hatch build from ASL Game 2 Fighting Spirit mining rates Zealot bombing is no longer popular?
Other Games
General Games
Stormgate/Frost Giant Megathread Dawn of War IV Path of Exile Nintendo Switch Thread PC Games Sales Thread
Dota 2
Official 'what is Dota anymore' discussion The Story of Wings Gaming
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
Five o'clock TL Mafia Mafia Game Mode Feedback/Ideas Vanilla Mini Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Mexico's Drug War Russo-Ukrainian War Thread NASA and the Private Sector
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! [Req][Books] Good Fantasy/SciFi books
Sports
2024 - 2026 Football Thread Tokyo Olympics 2021 Thread Formula 1 Discussion General nutrition recommendations Cricket [SPORT]
World Cup 2022
Tech Support
Laptop capable of using Photoshop Lightroom?
TL Community
The Automated Ban List
Blogs
Funny Nicknames
LUCKY_NOOB
Money Laundering In Video Ga…
TrAiDoS
Iranian anarchists: organize…
XenOsky
FS++
Kraekkling
Shocked by a laser…
Spydermine0240
Unintentional protectionism…
Uldridge
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1093 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
Hyrule19196 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
Hyrule19196 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
Hyrule19196 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
Hyrule19196 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
Monday Night Weeklies
17:00
#44
TKL 255
SteadfastSC163
IndyStarCraft 136
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
mouzHeroMarine 418
TKL 255
SteadfastSC 163
IndyStarCraft 136
UpATreeSC 131
RushiSC 85
JuggernautJason84
Livibee 24
StarCraft: Brood War
EffOrt 406
PianO 139
sorry 72
hero 71
Mini 64
NotJumperer 39
Rock 26
ivOry 8
Dota 2
qojqva4546
canceldota87
League of Legends
JimRising 409
Counter-Strike
fl0m2229
pashabiceps1467
byalli433
tarik_tv399
adren_tv82
oskar53
Heroes of the Storm
MindelVK24
Other Games
singsing1984
B2W.Neo988
Beastyqt631
ceh9581
ArmadaUGS155
ToD84
C9.Mang074
QueenE55
Trikslyr50
Mew2King48
Organizations
Dota 2
PGL Dota 2 - Main Stream565
Other Games
BasetradeTV109
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 17 non-featured ]
StarCraft 2
• Adnapsc2 8
• Reevou 2
• intothetv
• IndyKCrew
• sooper7s
• AfreecaTV YouTube
• Migwel
• LaughNgamezSOOP
• Kozan
StarCraft: Brood War
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• lizZardDota267
League of Legends
• Doublelift3031
• Jankos2025
• Shiphtur209
Other Games
• imaqtpie844
Upcoming Events
WardiTV Team League
17h 55m
PiGosaur Cup
1d 5h
Kung Fu Cup
1d 16h
OSC
2 days
The PondCast
2 days
KCM Race Survival
2 days
WardiTV Team League
2 days
Replay Cast
3 days
KCM Race Survival
3 days
WardiTV Team League
3 days
[ Show More ]
Korean StarCraft League
4 days
RSL Revival
4 days
Maru vs Zoun
Cure vs ByuN
uThermal 2v2 Circuit
4 days
BSL
5 days
RSL Revival
5 days
herO vs MaxPax
Rogue vs TriGGeR
BSL
6 days
Replay Cast
6 days
Replay Cast
6 days
Afreeca Starleague
6 days
Sharp vs Scan
Rain vs Mong
Wardi Open
6 days
Monday Night Weeklies
6 days
Liquipedia Results

Completed

Proleague 2026-03-15
WardiTV Winter 2026
Underdog Cup #3

Ongoing

KCM Race Survival 2026 Season 1
Jeongseon Sooper Cup
BSL Season 22
CSL Elite League 2026
RSL Revival: Season 4
Nations Cup 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual

Upcoming

ASL Season 21
Acropolis #4 - TS6
2026 Changsha Offline CUP
Acropolis #4
IPSL Spring 2026
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
NationLESS Cup
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
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 © 2026 TLnet. All Rights Reserved.