# Web Puzzles

Showing posts with label mathematical riddle. Show all posts

## Four Hats

Four men have been buried all the way to the neck, only their heads stick out. They cannot turn their heads, so they can see only in front of them. A wall has been placed between A and B, so that A cannot see the other 3 (B, C, D), and viceversa. All of them know in which position the others have been buried. So, for example, B knows that C and D can see him, even though he can't see them.

A hat has been placed on top of each man's head. All of them know that there are two black hats and two white hats, but no one is told the colour of the hat he's wearing.

They will all be saved if at least one of them can safely say what colour is the hat he's wearing. Otherwise they'll all be decapitated.

Which one of them saved the day? And, most importantly, how?

### Four Hats Puzzle Solution

C saves the day.

D clearly has the most information at his hands, but seeing one white and one black hat doesn't give him any certainty about his own hat's colour. Would B and C both have been wearing the same colour, D would have been able to provide the answer.

But C is one clever guy and he knows that if D doesn't answer, it means that B is wearing a different colour than him. Because B is wearing white, C knows he's wearing black.

Note that A is redundant: the puzzle could have included only B, C, D. That way, the hats would have been three, with two hats of the same unspecified colour, and one other hat of the opposite colour.

## Alan and Bert

I told Alan and Bert that I had two different whole numbers in mind, each bigger than 1, but less than 15. I told Alan the product of the two numbers and I told Bert the sum of the two numbers. I explained to both of them what I had done.

Now both these friends are very clever. In fact Bert, who is a bit of a know it all, announced that it was impossible for either of them to work out the two numbers. On hearing that, Alan then worked what the two numbers were!

What was the sum of the two numbers?

### Alan and Bert Puzzle Solution

Starting Numbers Sum Product Product can also be made using
6, 5 11 30 10, 3
7, 4 11 28 14, 2
8, 3 11 24 6, 4 and 12, 2
9, 2 11 18 6, 3 and 9, 2
Bert knows that there are four possibilities for the starting numbers - so it is impossible to work out the starting numbers using the sum alone.

As mentioned in the question, he's quite clever - so he looks at the product that would appear if he used each of the four possible combinations. As shown in the table above, the product that appears can also be made from different numbers.

So, he announces that it is impossible for him or Alan to work out what the original numbers were. He seems to be on fairly safe ground.

Alan is a little bit more devious as well as being clever. Armed with this snippet of information he needs to look for a pair of numbers that give a non-unique sum and also give a non-unique product.
11 is the only non-unique sum which always gives a non-unique product. Alan is very clever and very smug.

## Hansel And Gretal

I walk in a straight line in the forest. As I walk, I leave a repeating pattern of 1's and 0's behind me.

What is the length of the shortest pattern such that if you happen along my trail, you can determine with certainty which direction I was going?

### Hansel And Gretal Puzzle Solution

One solution is 010011, and is probably the shortest. In a repeating series of this pattern, we may get:
...11010011010011010011010011...

If we are to look through the sequence, we should find that we can match the pattern 010011 but not the reverse pattern, 110010. Hence we know which direction the person was travelling.
...11010011010011010011010011...