If a random number generator produces integers from 1 to 1000, what is the probability that a number divisible by 2 or 5 is generated?
Instruction: Choose an integer uniformly from 1 through 1,000, inclusive. What is the probability that it is divisible by 2 or by 5, including numbers divisible by both?
Context: This question evaluates the candidate's ability to apply set theory principles to solve a probability problem involving divisibility.
Updated
Official answer
Use inclusion-exclusion. Among the integers 1 through 1,000:
- 500 are divisible by 2.
- 200 are divisible by 5.
- 100 are divisible by both, meaning divisible by 10.
The favorable count is 500 + 200 - 100 = 600, so the probability is 600/1000 = 3/5 = 60%.
Subtract the overlap once because it was counted in both initial groups. Here “or” includes numbers divisible by both. If “exactly one of 2 or 5” were required, the count would instead be 500 + 200 - 2(100) = 500.
Related Questions
-
medium
-
hard