The number of integers between 1 and 500 (both inclusive) that are divisible…

2017

The number of integers between 1 and 500 (both inclusive) that are divisible by 3 or 5 or 7 is ____________ .

Attempted by 47 students.

Show answer & explanation

Correct answer: 271

Solution: Use the inclusion-exclusion principle to count numbers divisible by 3 or 5 or 7 between 1 and 500.

  • Count divisible by 3: floor(500/3) = 166.

  • Count divisible by 5: floor(500/5) = 100.

  • Count divisible by 7: floor(500/7) = 71.

  • Subtract counts of numbers counted twice (pairwise intersections):

  • Divisible by both 3 and 5 (LCM 15): floor(500/15) = 33.

  • Divisible by both 3 and 7 (LCM 21): floor(500/21) = 23.

  • Divisible by both 5 and 7 (LCM 35): floor(500/35) = 14.

  • Add back numbers counted three times (common to 3, 5, and 7): LCM 105 => floor(500/105) = 4.

Apply inclusion-exclusion:

Total = 166 + 100 + 71 - (33 + 23 + 14) + 4 = 271.

Therefore, there are 271 integers between 1 and 500 inclusive that are divisible by 3 or 5 or 7.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir