Wednesday, June 21, 2017

Will You Crack the Code?


(Source: all over the place; no idea about exact origin)

First, note that an implicit assumption in the problem is that no digits will be repeated in the solution. Then start with the first triplet, 682. One (and presumably only one) digit is correct and well-placed. It can't be six because then the description of the second triplet could not be true. Nor can it be eight, because the fourth triple, 738, is described as having nothing correct. This means that two is correct and in the right place.

Next, focus on the last two triplets. The "intersection" of the two, as it were, is seven and eight, that is, the two digits they have in common. Because everything is wrong in the fourth triplet, this means that the one correct, but wrongly placed digit is zero.

It is already known that the zero can't occupy the third position of the triplet, because two already has that. Additionally, the third triplet and its description tell us the middle position cannot be occupied by zero, leaving us with 0-2. The only task remaining is to find out the middle digit.

All but two candidates can be ruled out. Zero and two have already been used up. Three, seven and eight are explicitly ruled out. Six was implicitly ruled out in the first paragraph of this solution. That leaves one and four. If the missing digit is one, then the description of the second triplet is false. All that leaves is four.

Final answer: 042. (Don't panic?)