A cipher machine scrambles three-digit locker combinations. The code 481 yields one correct digit in the correct position. The code 185 yields one correct digit in the wrong position. The code 542 yields two correct digits, both in the wrong position. The code 667 yields no correct digits. What is the exact three-digit combination?
428
From 667, 6, 6, and 7 are eliminated entirely. From 481, since 1, 4, or 8 is correct in position: in 185, 1, 8, or 5 is correct out of position. Comparing 481 and 185, 8 is in the middle for both. If 8 were the correct digit in the correct position for 481, then for 185 it would be in the correct position too, but it says 'wrong position' for 185, contradiction. Thus 8 is not the middle digit. If 1 is correct in 481 (position 3), then in 185 it's in position 1 (wrong position), which fits. Let's test 542: two correct digits, wrong positions. 5, 4, 2 are all valid candidates since 6, 6, 7 are dead. Specifically, 4 and 2 must be in the code. Through logical deduction of positions, 4 is first, 2 is third, and 8 is second, yielding 428.
About this riddle
Math riddles hide a calculation inside a short story. Pull out the numbers, work out what is being asked, and watch for a trick such as a unit change.
Difficulty: Hard. More like this: Math riddles with answers or try Target 24 for a different kind of puzzle.
More math riddles
I am a two-digit number greater than 50. Add my digits together and you get 11. Subtract the smaller digit from the larger, and you get 5. What number am I?
Lily makes 2 rows of 4 erasers and adds 4 more at the end. How many erasers are there in all?
A father is four times as old as his son. In 20 years, the father will be only twice as old as his son. How old is the son right now?
A lily pad doubles in size every day. If it completely covers a pond in 30 days, on which day did it cover exactly half of the pond?
Mia puts 4 rabbits in each of 5 boxes. How many rabbits is that altogether?
A rectangular garden has a perimeter of 50 meters. Its length is 5 meters greater than its width. What is the area of the garden in square meters?

