The number of integers between 1 and 500 (both inclusive) that are divisible by 3 or 5 or 7 is
Let A = {Integers between 1 to 500 divisible by 3}
B = {Integers between 1 to 500 divisible by 5}
C = {Integers between 1 to 500 divisible by 7}
To find number of integers between 1 to 500 that are divisible by 3 or 5 or 7 is
n(A∪B∪C)=n(A)+n(B)+n(C)−n(A∩B)
−n(A∩C)−n(B∩C)+n(A∩B∩C)
=([5003]+[5005]+[5007])−{[50015]+[50021]+[50035]}+[500105]
=(166+100+71)−(33+23+14)+4
=337−70+4=271