# How many integers are multiples between a specific set?

I have a question that I have tried, but it doesn't have an answer and I can't check my work. The question is:

Find out how many integers are in [100, 999] that are multiples of 2, 3, or 5.


The first thing I did was subtract 999 with 100 to get 899. I denoted 2 as P, 3 as Q and 5 as R. I made this inclusion/exclusion formula to get the answer:

N(P $\cup$ Q $\cup$ R) = N(P) + N(Q) + N(R) - N(P $\cap$ Q) - N(Q $\cap$ R) - N(P $\cap$ R) + N(P $\cap$ Q $\cap$ R)

For P, I found there to be 449 integers that divide by 2. For Q, I found there to be 299 integers that divide by 3. For R, I found there to be 179 integers that divide by 5. Combining all of these numbers, I came up with 927. For N(P $\cap$ Q), the number I found was 149. For N(Q $\cap$ R), I found the number to be 59. For N(P $\cap$ R), I found the number to be 89. I subtracted the total of these numbers with 927 to get (927 - 297) to get 630.

Did I do this correctly?

• Your logic is correct, there can only be a calculation error, and I know the answer to this one is 630, so you should be right. – астон вілла олоф мэллбэрг Apr 14 '16 at 2:49
• Let us count, slowly, the numbers between $100$ and $999$ (inclusive) that are divisible by $2$. This is the number of evens from $2$ to $998$, minus the number of evens from $2$ to $98$. There are $499$ in the first bunch and $49$ in the second, for a difference of $450$. There may be similar little errors in the other computations. – André Nicolas Apr 14 '16 at 2:53
• @AndréNicolas So it's 999 - 100 + 1? Why do we add 1? – user2896120 Apr 14 '16 at 2:58
• The number of integers between $a$ and $b$ inclusive is $b-a+1$. But I did not use a formula, just figured it out. There are just as many evens from $2$ to $998$ as there are numbers from $1$ to $499$. That's $499$. – André Nicolas Apr 14 '16 at 3:03
• For divisible by $3$, let's do it another way. The number of such numbers from $102$ to $999$ is the number of numbers from $34$ to $333$, which is $300$. – André Nicolas Apr 14 '16 at 3:06

You've apparently made two mistakes: (1) you neglected to add $1$ to the difference when counting the integers in an inclusive range, and (2) you neglected to add the final term N(P ∩ Q ∩ R), which is $30$. Correcting these will give the answer $(450 + 300 + 180 - 150 - 60 - 90 + 30 = 660)$.
You cannot just use the number of numbers in the range to determine how many are multiples of something. For example, there are two even numbers in the range $[2..4]$ but only one even number in the range $[3..5]$. That is why Andre's comment tells you to identify the first and last multiple in the range, which you can then use to determine how many there are.