Question
The number of integers between 1 and 500 (both inclusive) that are divisible by 3 or 5 or 7 is ______.
Official answer and solution
- Official answer
- 271
- From
- Official GATE 2017 answer key
Solution
Apply the Principle of Inclusion-Exclusion to count integers between 1 and 500 divisible by 3, 5, or 7.
Let , so .
Let be the subsets of containing integers divisible by 3, 5, and 7 respectively.
Calculate the size of each subset:
Calculate the pairwise intersections using least common multiples:
Calculate the three-way intersection:
Applying the Principle of Inclusion-Exclusion:
271.0
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2017 Computer Science and Information Technology (CS) Session 1
- Question
- 47 of 65, printed as CS Q.47
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.