NOTE: If you say BETWEEN 1 and 500, I'm assuming that we're NOT INCLUDING 1 and 500, otherwise we should say "from 1 to 500 INCLUSIVE"sgr21 wrote:how many such numbers are there between 1& 500 that are multiples of either 3 or 7 or both?
Also, I'm assuming that you meant to say, "multiples of either 3 or 7 or both["
Okay, onto to solution...
Here's a nice rule: If x and y are multiples of k, then the number of multiples of k from x to y inclusive = [(y-x)/k] + 1
So, for example, the number of multiples of 3 from 6 to 21 inclusive = [(21 - 6)/3] + 1 = [15/3] + 1 = 6
For this question, we must recognize that: multiples of 3 or 7 or both = (multiples of 3) + (multiples of 7) - (multiples of 3 AND 7)
In other words, multiples of 3 or 7 or both = (multiples of 3) + (multiples of 7) - (multiples of 21)
multiples of 3
We want multiples of 3 from 3 to 498 inclusive
Using our formula, this = [(498 - 3)/3] + 1
= [495/3] + 1
= 166
multiples of 7
We want multiples of 7 from 7 to 497 inclusive
Using our formula, this = [(497 - 7)/7] + 1
= [490/7] + 1
= 71
multiples of 21
We want multiples of 21 from 21 to 483 inclusive
Using our formula, this = [(483 - 21)/21] + 1
= [462/21] + 1
= 23
So, multiples of 3 or 7 or both = 166 + 71 - 23) = 214
Cheers,
Brent


















