One person comes up to another person beside his bike. "Can I use your bike?" he asks. The person by the bike replies, "Only if you figure out the combination to my bike lock, which is made up of 4 different numbers from 1 through 8. You can guess 3 numbers."
He guessed 1235, 4721, and 3862. All three were answered with "One number in the combination is in the wrong place, and another is in the right place. The other two aren't in the combination."
The guesser was puzzled and asked "Is the number divisible by 7?" The person with the bike answered this question and after thinking for a while, the guesser told him the combination. What is the combination?
From the first guess then the combination contains one of the following pairs of numbers; (1,2) (1,3) (1,5) (2,3) (2,5) (3,5)
Four of these pairs can be ruled out as follows:
If (1,2) is in the combination, then guess 1 rules out 3&5, guess 2 rules out 4&7 and guess 3 permits only one of either 6 or 8. This only gives three digits in the combination, so (1,2) is not a valid pair.
If (2,3) is in the combination, then guess 1 rules out 1&5, guess 3 rules out 6&8, guess 2 permits only one of either 4 or 7. This only gives three digits in the combination, so (2,3) is not a valid pair.
If (1,5) is in the combination then guess 1 rules out 2&3, thus guess 2 gives one of either 4 or 7 and guess 3 gives that both 6&8 must be in the combination. This gives 5 digits in the combination, so (1,5) is not a valid pair.
If (3,5) is in the combination, then guess 1 rules out 1&2, thus guess 2 gives that both 4&7 must be in the combination and guess 3 gives that one of either 6 or 8 must be in the combination.. This gives 5 digits in the combination, so (3,5) is not a valid pair.
This leaves us with (1,3) and (2,5) as the only valid pairs. In the first guess for each of these pairs one of the digits is in the correct place and the other is in the wrong place. Going through the possibilities gives:
Assume 1 is in the correct place and 3 is in the wrong place:
Guess 2 shows that the 2nd digit must be 7 Therefore the 4th digit must be 3
Guess 3 shows that the 3rd digit must be 6
This gives combination 1763 (which is not divisible by 7)
Assume 3 is in the correct place and 1 is in the wrong place:
Guess 3 shows that the 2nd digit must be 8
Therefore the 4th digit is 1
Guess 2 then shows that the 1st digit is 7
This gives combination 7831 (which is not divisible by 7)
Assume 2 is in the correct place and 5 is in the wrong place:
Guess 2 shows that the 1st digit must be 4, therefore the 3rd digit must be 5
However, guess 3 shows that the 3rd digit must be 6
Therefore there are no valid combinations for this possibility.
Assume 5 is in the correct place and 2 is in the wrong place, this gives either 2xx5 or xx25.
Taking the xx25 possibility first:
Guess 3 shows that the 2nd digit must be 8
Guess 2 then shows that the 1st digit must be 7
This gives combination 7825 (which is not divisible by 7)
Now taking the 2xx5 possibility:
Guess 2 shows that the 2nd digit is 7
Guess 3 shows that the 3rd digit is 6
This gives combination 2765 (which is divisible by 7)
So there are 3 combinations not divisible by 7 and a single combination that is divisible by 7. Therefore since the guesser was able to correctly determine the combination then the combination must be 2765.

Posted by fwaff
on 20031118 11:57:59 