A person forgets his 4-digit ATM pin code. But he remembers that in the code all the digits are different, the greatest digit is 7 and the sum of the first two digits is equal to the sum of the last two digits. Then the maximum number of trials necessary to obtain the correct code is
Answer: 72
Solution
All four digits are different with largest digit 7, so they are drawn from {0,1,…,7} with 7 present, and the four digits split into a front pair and a back pair of equal sum s. One pair must contain 7, namely {7,s−7}, and the other is a disjoint pair of distinct digits also summing to s. The admissible choices are, by s: for s=7, {1,6},{2,5},{3,4} together with {7,0}; for s=8, {2,6},{3,5} with {7,1}; for s=9, {3,6},{4,5} with {7,2}; for s=10, {4,6} with {7,3}; for s=11, {5,6} with {7,4} — nine choices in all. Each choice fixes the two pairs, and the code is then formed by selecting the front pair (2 ways) and ordering each pair (2×2), giving 8 codes per choice. Hence the number of possible codes is 9×8=72, which is the maximum number of trials required.