Maths Olympiad Prep

Library / /129 of 168

Algebra Difficulty 2.3 Junior Find the answer

What is the sum of all of the possibilities for Sam's number if Sam thinks of a 5-digit number, Sam's friend Sally tries to guess his number, Sam writes the number of matching digits beside each of Sally's guesses, and a digit is considered "matching" when it is the correct digit in the correct position?

A number or a short expression. Spacing and $ signs are ignored.

Solution

We label the digits of the unknown number as vwxyz.
Since vwxyz and 71794 have 0 matching digits, then v7v \neq 7 and w1w \neq 1 and x7x \neq 7 and y9y \neq 9 and z4z \neq 4.
Since vwxyz and 71744 have 1 matching digit, then the preceding information tells us that y=4y=4.
Since vwx4zv w x 4 z and 51545 have 2 matching digits and w1w \neq 1, then vwxyzv w x y z is of one of the following three forms: 5wx4z5 w x 4 z or vw54zv w 54 z or vwx45v w x 45.
Case 1: vwxyz =5wx4z=5 w x 4 z
Since 5wx4z5 w x 4 z and 21531 have 1 matching digit and w1w \neq 1, then either x=5x=5 or z=1z=1.
If x=5x=5, then 5wx4z5 w x 4 z and 51545 would have 3 matching digits, which violates the given condition. Thus, z=1z=1.
Thus, vwxyz=5wx41v w x y z=5 w x 41 and we know that w1w \neq 1 and x5,7x \neq 5,7.
To this point, this form is consistent with the 1st, 2 nd, 3 rd and 7 th rows of the table.
Since 5wx415 w x 41 and 59135 have 1 matching digit, this is taken care of by the fact that v=5v=5 and we note that w9w \neq 9 and x1x \neq 1.
Since 5wx415 w x 41 and 58342 have 2 matching digits, this is taken care of by the fact that v=5v=5 and y=4y=4, and we note that w8w \neq 8 and x3x \neq 3.
Since 5wx415 w x 41 and 37348 have 2 matching digits and y=4y=4, then either w=7w=7 or x=3x=3.
But we already know that x3x \neq 3, and so w=7w=7.
Therefore, vwxyz =57x41=57 x 41 with the restrictions that x1,3,5,7x \neq 1,3,5,7.
We note that the integers 57041,57241,57441,57641,57841,5794157041,57241,57441,57641,57841,57941 satisfy the requirements, so are all possibilities for Sam's numbers.
Case 2: vwxyz =vw54z=v w 54 z
Since vw54zv w 54 z and 51545 have only 2 matching digits, so v5v \neq 5 and z5z \neq 5.
Since vw54zv w 54 z and 21531 have 1 matching digit, then this is taken care of by the fact that x=5x=5, and we note that v2v \neq 2 and z1z \neq 1. (We already know that w1w \neq 1.)
Since vw54zv w 54 z and 59135 have 1 matching digit, then v=5v=5 or w=9w=9 or z=5z=5.
This means that we must have w=9w=9.
Thus, vwxyz =v954z=v 954 z and we know that v2,7,5v \neq 2,7,5 and z1,4,5z \neq 1,4,5.
To this point, this form is consistent with the 1 st, 2 nd, 3 rd , 4 th, and 7 th rows of the table.
Since v954zv 954 z and 58342 have 2 matching digits and v5v \neq 5, then z=2z=2.
Since v9542v 9542 and 37348 have 2 matching digits, then v=3v=3.
In this case, the integer 39542 is the only possibility, and it satisfies all of the requirements.
Case 3: vwxyz =vwx45=v w x 45
Since vwx45v w x 45 and 21531 have 1 matching digit and we know that w1w \neq 1, then v=2v=2 or x=5x=5.
But if x=5x=5, then vw545v w 545 and 51545 would have 3 matching digits, so x5x \neq 5 and v=2v=2.
Thus, vwxyz =2wx45=2 w x 45 and we know that w1w \neq 1 and x5,7x \neq 5,7.
To this point, this form is consistent with the 1st, 2 nd, 3rd and 7 th rows of the table.
Since 2wx452 w x 45 and 59135 have 1 matching digit, this is taken care of by the fact that z=5z=5 and we note that w9w \neq 9 and x1x \neq 1.
Since 2wx452 w x 45 and 58342 have 2 matching digits, then w=8w=8 or x=3x=3, but not both.
Since 2wx452 w x 45 and 37348 have 2 matching digits, then w=7w=7 or x=3x=3, but not both.
If w=8w=8, then we have to have x3x \neq 3, and so neither w=7w=7 nor x=3x=3 is true.
Thus, it must be the case that x=3x=3 and w7,8w \neq 7,8.
Therefore, vwxyz =2w345=2 w 345 with the restrictions that w1,7,8,9w \neq 1,7,8,9.
We note that the integers 20345,22345,23345,24345,25345,2634520345,22345,23345,24345,25345,26345 satisfy the requirements, so are all possibilities for Sam's numbers.
Thus, there are 13 possibilities for Sam's numbers and the sum of these is 526758.

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: Omni-MATH, licensed Apache-2.0. Statement and solution reproduced as published; topic and difficulty added by this site.