The number of integers between 1 and 500 (both inclusive) that are divisible by 3 or 5 or 7 is ____________ .
GATE CSE 2017Set Theory & Algebra › Set Theory & CombinatoricsVerified
GATE CSE 2017 PYQ: The number of integers between 1 1 1 and 500 500 500 (both inclusive) that are divisible by 3 3 3 or 5 5 5…
Answer
271
Approach
Use the inclusion-exclusion principle for the three divisibility sets: count multiples of 3, 5, and 7, subtract pairwise overlaps, and add back the triple overlap. Since all numbers are within 1 to 500 inclusive, each count is a floor division by the divisor or least common multiple.
Inclusion-exclusion gives the exact count of integers from 1 to 500 divisible by 3, 5, or 7 as 271.
Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.