Hats in 2015

Logic Level 2

There are 2015 people standing in a line. Each person is given one hat to wear. A hat has one of 2015 possible colors, and it is possible to distinguish from these 2015 colors. Duplicate hat colors are possible.

A person cannot see his own hat color or the hats of the people behind him, but he can see the colors of the hats of all the people in front of him. (Note that the person at the back of the line can see everyone else's hats and the person in front can see no one's hats.)

Starting from the back of the line and moving to the front, each person is asked to guess the color of their own hat. If a person guesses his or her hat color correctly, the person gets to keep the hat. If not, he or she has to give up the hat.

The 2015 people are allowed to devise a strategy before they form the line. They agree on a strategy that maximizes the number a a of hats guaranteed to be kept. What is a a ?


The answer is 2014.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Steven Yuan
Sep 14, 2015

You may have seen an easier problem with only two or three hat colors possible. Nevertheless, the strategy here is still the same. First, the people set each hat color to a distinct residue ( m o d 2015 ) \pmod{2015} i.e. color 1 is 0 ( m o d 2015 ) 0 \pmod{2015} , color 2 is 1 ( m o d 2015 ) 1 \pmod{2015} , and so forth.

When the person in the back is asked to guess her own hat color, instead she adds up the values of the colors of all the hats in front of her and says the hat color that corresponds with her result. For example, if the first person had a hat with color 5 and the rest had hats with color 2, she would calculate 2013 ( 1 ) + 4 ( m o d 2015 ) 2013(1) + 4 \pmod{2015} , which is 2 ( m o d 2015 ) 2 \pmod{2015} . The hat color corresponding to 2 ( m o d 2015 ) 2 \pmod{2015} is color 3, so she would say that color, whatever it is. It is not guaranteed that she will guess her own hat color correctly, though.

Continuing with our example, the person that is second to last hears the last person say "color 3" and immediately knows that the sum of the 2013 2013 hat in front of him plus his own is congruent to 2 ( m o d 2015 ) 2 \pmod{2015} . He sees 2012 2012 hats of color 2 and 1 1 hat of color 5, so he calculates the sum of the hats in front of him as 2012 ( 1 ) + 4 1 ( m o d 2015 ) 2012(1) + 4 \equiv 1 \pmod{2015} . Then, he would know that the color of the hat on his head was congruent to 2 1 1 ( m o d 2015 ) 2 - 1 \equiv 1 \pmod{2015} , which corresponds to color 2. So, he says that color out loud, and he would get to keep his hat.

This continues up to the first person in line. Therefore, at a minimum, the first 2014 people get to keep their hats and the last person does not, so the answer is 2014 \boxed{2014} .

Vivian Liang
Dec 12, 2015

Everyone tells the person in front of them their colour of their hat. That guarantees 2014 hats. The first person says nothing. The last person guessing from 2015 colours is highly unlikely to get it correct.

e.g. If the order of a line up is ABCDEFG, G tells F the colour of F's hat. F tells E the colour of E's hat. E tells D the colour of D's hat and so on. A has no clue about the colours of the hats and G guesses out of the many possibilities of hat colours.

Fathan Ihsan
Sep 30, 2015

Since there's no regulations mentioned except standing in a line and guessing the hat's color correctly to keep it, a strategy where person A would tell the B's hat color (assume that B is standing in front of A) is possible and so on, this strategy ensures 2014 hats to be kept. Therefore a = 2014 or possibly 2015 if the first person guessed the right color.

The first person to guess could install an observant behind him/her to ensure that 2015 hats will be kept.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...