Joe, John and Kim wake up in a room. Inside the room there is a scale and three sealed bags filled with
coins. There is a locked door with a numeric keypad. There is a speaker in the room. A voice comes
through it:

*"The only way out is to key in the correct code on the keypad, you have one attempt only. I have a
certain number of coins. One third of those coins are in your room divided into the three sealed bags
you see in front of you. You are not allowed to open the bags, nor attempt to count the coins. But you
are free to weigh them. The weight of the bag is negligible."*
They each grab a bag and by using the scale they determine that John's bag weighs twice as much as Joe's
bag and that Kim's bag weighs three times as much as Joe's bag.

The speaker continues:

*"I have more than 100 coins, but less than 1000 and all the coins are the
exact same weight. The number of coins I have is the passcode to open the door. At least 2 of the digits
are identical and the number is a perfect square. Escape is possible."*
Kim (after examining the keypad):

*"it's a 3x3, nine-digit keypad, first number on the top left is
0, then 1, 2, 3, etc."*
Do Joe, John, and Kim have enough information to ensure exit from the room and if so, what is the code?

**ANSWER**:

*Yes, given the information, 144 is the only possible code.*
**EXPLANATION**: Let

**x** represent the number of coins in Joe's bag.
Therefore there are 2

**x** coins in John's bag and 3

**x** coins in Kim's bag
for a total of 6

**x** coins in the room. Only one third of the coins are in the room so
the total number of coins is 18

**x** and is therefore evenly divisible by 18 (i.e. no
remainder). So the code is a perfect square that is greater than 100 and less than 1000, is divisible
evenly by 18, and contains at least two identical digits. Let's begin with the list of 21 perfect
squares greater than 100 and less than 1000:

121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529, 576, 625, 676, 729, 784, 841, 900,
and 961.

Of those, only 144, 324, 576, and 900 are evenly divisible by 18. Of those four numbers, only 144
and 900 contain at least two identical digits. However, there are only 9 digits on the 3x3 keypad
and the first one is a 0, which means there is no 9. So 900 cannot be the code because that would make
escape impossible. The code therefore is 144.