1. Let's take the first remainder first. A great number that will yield a remainder of 2 when divided by 5 is the number 2 itself, so let's take 2 as the starting point.

2. Note that you can add 5 to the starting point as often as you like, the remainder when dividing by 5 won't change (of course). And that's good because that remainder is already perfect and we don't want to spoil that.

3. But each time you add 5, the remainder when dividing by 7 **will** change. So let's repeatedly add 5 to the starting point until the remainder when dividing by 7 is exactly right. We arrive at 17, let's call that the new starting point. Now the remainder when dividing by 5 is fine, and the remainder when dividing by 7 is fine, too. Let's keep both fine from now on.

4. Note that you can add 35 (or 5 times 7) to the new starting point as often as you like: The remainder when dividing by 5 won't change, and the remainder when dividing by 7 won't change either.

5. But the remainder when dividing by 8 **will** change each time. So let's add 35 to the new starting point until that remainder is exactly right. We end up with 157.

6. In this case, this number will work and is a solution to the puzzle. However, the keypad for entering the number doesn't have a zero. So what do we do in cases where we end up with a number that contains a zero? In this case, we can add 280 (or 5 times 7 times 8) to it as often as we like, it won't change the remainders when dividing by 5, by 7, or by 8. We'll do that until we arrive at a number that doesn't contain zeros.