2
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – астон вілла олоф мэллбэрг Apr 14 '16 at 2:49
  • $\begingroup$ 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. $\endgroup$ – André Nicolas Apr 14 '16 at 2:53
  • $\begingroup$ @AndréNicolas So it's 999 - 100 + 1? Why do we add 1? $\endgroup$ – user2896120 Apr 14 '16 at 2:58
  • $\begingroup$ 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$. $\endgroup$ – André Nicolas Apr 14 '16 at 3:03
  • $\begingroup$ 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$. $\endgroup$ – André Nicolas Apr 14 '16 at 3:06
1
$\begingroup$

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)$.

$\endgroup$
1
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ I am not dividing the range by the multiple. I am finding the next multiple going down from 899, and dividing it by that multiple. For example, 898 / 2 would yield 449 $\endgroup$ – user2896120 Apr 14 '16 at 3:08
  • $\begingroup$ @user2896120: Your first statement is "The first thing I did was subtract 999 with 100 to get 899." which is useless for the reason I gave in my answer. You should also try your method with small ranges to check whether they actually work. $\endgroup$ – user21820 Apr 14 '16 at 3:14
  • $\begingroup$ In class, my professor used this method for numbers starting from 1 through 999, but he never showed examples that didn't start from 1. $\endgroup$ – user2896120 Apr 14 '16 at 3:19
  • $\begingroup$ @user2896120: Exactly. That's my point. You shouldn't (if possible) use a method unless you understand it. The correct method is not as you started with but as I've described here; identify the first and last multiple of which you seek, and then calculate how many jumps to get from one to the other, and then you know how many there are. 1 jump? 2 numbers. 2 jumps? 3 numbers. And so on. $\endgroup$ – user21820 Apr 14 '16 at 3:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.