Let be the set of all passwords which are six to eight characters long, where each character is either an alphabet from or a number from with the repetition of characters allowed. If the number of passwords in whose at least one character is a number from is , then is equal to
Solution
Core idea. At least one is counted as all possibilities less those with none.
Concept refresher. With repetition allowed, places can be filled from characters in ways, and
Picture the situation. There are ten characters, five letters and five numbers, and a password has six, seven or eight of them with repetition allowed. Having at least one number is the opposite of having letters only. So for each length the count is all passwords less the letter-only ones, and both of those are simple powers.
Approach. Count by complement for each length, add the three lengths, and factor out the required power.
Step 1: Each length
A password of length with at least one number can be formed in ways.
Step 2: Add the lengths
For , 7 and 8 the total is
so .
Answer. 7073
Sanity check. Most passwords contain a number, so the count should be close to the number of all passwords, , and 7073 is just below 7104.
Common wrong answers
- 7104: Not subtracting the letter-only passwords gives .
Key takeaway
The trap. The letter-only passwords must be removed for every length.
How toppers think. They factor each term before adding, so the common power comes out at once.
Remember.