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________.
Solution
Core idea. A condition on sums is handled by fixing the partner of the special digit.
Concept refresher. If one choice can be made in ways and, for each of these, a second in ways, the two together can be made in
ways.
Picture the situation. The code has four different digits, the largest being 7, so the other three are below 7, and 0 may appear anywhere because a code is not a number. The first two digits form one pair and the last two another, with equal sums. The digit 7 sits in one of the pairs, so its partner must be small enough for two smaller digits to match the sum.
Approach. Go through the partners of 7, list the matching pairs, and multiply by the number of orders.
Step 1: Partner of 7
Let the partner of 7 be ; the other pair has two different digits below 7, different from , adding to . For the pairs are 1, 6; 2, 5; 3, 4. For : 2, 6; 3, 5. For : 3, 6; 4, 5. For : 4, 6. For : 5, 6. Larger gives none, so there are 9 choices.
Step 2: Order
Each pair can be written in 2 orders, and the pair with 7 can come first or last, so each choice gives codes. The number of possible codes, and so of trials, is .
Answer. 72
Sanity check. One such code is 7016: the digits are different, the greatest is 7, and 7 plus 0 equals 1 plus 6.
Common wrong answers
- 36: Forgetting that the pair containing 7 can be the first two or the last two digits gives 36.
Key takeaway
The trap. A code may start with zero, unlike a number.
How toppers think. They count unordered choices first and multiply by the orders at the end.
Remember. 9 choices of pairs, 8 orders each.
More on Permutations
- The number of 4 -letter words, with or without meaning, each consisting of two vowels and two consonants…
- The number of ways, of forming a queue of 4 boys and 3 girls such that all the girls are not together, is:
- Three persons enter in a lift at the ground floor. The lift will go up to 10^th floor. The number of ways…
- All 55 on Permutations ›