Carlos uses a -digit passcode to unlock his computer. In his passcode, exactly one digit is even, exactly one (possibly different) digit is prime, and no digit is . How many -digit passcodes satisfy these conditions?
- A)
- B)
- C)
- D)
- E)
Answer
D
Key insight
Sort the digits 1-9 into even only {4,6,8}, prime only {3,5,7}, both {2}, and neither {1,9}, then split on whether one digit does both jobs or two digits do.
Solution
The available digits are through . Sort them by the two properties:
- even and prime: (one digit),
- even but not prime: (three digits),
- prime but not even: (three digits),
- neither: (two digits).
Exactly one position holds an even digit and exactly one position holds a prime digit. Those two positions may or may not coincide.
One digit does both jobs. That digit must be , and the other three digits must be neither even nor prime, so each is or . Choose the position of the in ways and fill the rest in ways:
Two different positions. One position holds an even non-prime digit ( choices) and a different position holds a prime non-even digit ( choices); the other two positions are or . Note that cannot appear here, since it would make the even count and the prime count both too large. Choosing the two special positions in order gives ways:
The two cases are disjoint, so the total is
The answer is .
Why this works
Two overlapping conditions ("exactly one even" and "exactly one prime") are cleanest to handle by first classifying the alphabet of digits by which conditions each digit satisfies. Once the four classes are written down, the only structural question left is whether the even slot and the prime slot are the same slot, and each case is a straight multiplication. The classification also makes clear why and are the only legal fillers for the remaining positions, which is the step most easily lost when counting on the fly.
Alternative approach
Choose the multiset of digit types first. If the passcode contains a , the rest are from : . If not, it contains exactly one of and exactly one of and two from : choose which two of the four positions are special and which is which (), then the digits (). Same .
The trap
Counting only the case of two different special digits, 4*3 positions times 3*3 digits times 2^2, which gives 432, choice (C).
Common mistakes
- Counting only the case of two different special digits, 43 positions times 33 digits times 2^2, which gives 432, choice (C).
- Treating as merely even and allowing it alongside a separate prime digit, which double counts the prime condition.
- Allowing to count as prime, or forgetting that is neither even nor prime, so that the filler digits are miscounted.
Techniques
Split into exhaustive cases and handle each · Set up the equation/formula and compute; no special trick needed