# How many of the integers between $1$ and $200$ are odd numbers or divisible by $3$ or divisible by $5$?

How many of the integers between $$1$$ and $$200$$ are odd numbers or divisible by $$3$$ or divisible by $$5$$? \begin{align*} A_1 & = \left\lfloor{\frac{200}{3}} \right\rfloor = 66 && \text{(divisible by 3)}\\ A_2 & = \left\lfloor{\frac{200}{5}} \right\rfloor = 40 && \text{(divisible by 5)}\\ A_3 & = \left\lfloor{\frac{200}{2}} \right\rfloor = 100 && \text{(odd)}\\ | A_1 \cap A_2 | & = \left\lfloor{\frac{200}{3 \cdot 5}}\right\rfloor = 13\\ | A_1 \cap A_3 | & = \left\lfloor{\frac{200}{3 \cdot 2}}\right\rfloor = 33\\ | A_2 \cap A_3 | & = \left\lfloor{\frac{200}{5 \cdot 2}} \right\rfloor= 20\\ | A_1 \cap A_2 \cap A_3 | & = \left\lfloor{\frac{200}{5 \cdot 2 \cdot 3}}\right\rfloor = 6 \end{align*}

Therefore, by the principle exclusion inclusion theorem $$= 66 + 40 + 100- (13 + 33 + 20) + 6 = 146$$

Is this logically right?

• This tutorial explains how to typeset mathematics on this site. – N. F. Taussig Feb 12 at 10:23
• @N.F.Taussig Thanyou so much for the edit. I didnt know how to write floor function in latex – kili Feb 12 at 11:02

Your answer is incorrect. While it is true that there are positive odd integers less than or equal to $$200$$, what you have actually calculated with the expression $$\left\lfloor \frac{200}{2} \right\rfloor$$ is the number of even integers less than or equal to $$200$$. It just so happens that $$200 - 100 = 100$$. Similarly, there are $$\left\lfloor \frac{200}{2 \cdot 3} \right\rfloor = 33$$ positive integers less than or equal to $$200$$ that are divisible by both $$2$$ and $$3$$, $$\left\lfloor \frac{200}{2 \cdot 5} \right\rfloor = 20$$ positive integers less than or equal to $$200$$ that are divisible by both $$2$$ and $$5$$, and $$\left\lfloor \frac{200}{2 \cdot 3 \cdot 5} \right\rfloor = 6$$ positive integers less than or equal to $$200$$ that are divisible by $$2$$, $$3$$, and $$5$$.

However, we can work with these numbers.

Let $$A$$ be the set of positive odd integers less than or equal to $$200$$ which are odd; let $$B$$ be the set of positive integers less than or equal to $$200$$ which are multiples of $$3$$; let $$C$$ be the set of positive integers less than or equal to $$200$$ which are multiples of $$5$$. Then \begin{align*} |A| & = 200 - \left\lfloor \frac{200}{2} \right\rfloor = 100\\ |B| & = \left\lfloor \frac{200}{3} \right\rfloor = 66\\ |C| & = \left\lfloor \frac{200}{5} \right\rfloor = 40\\ |A \cap B| & = 66 - \left\lfloor \frac{200}{2 \cdot 3} \right\rfloor = 66 - 33 = 33\\ |A \cap C| & = 40 - \left\lfloor \frac{200}{2 \cdot 5} \right\rfloor = 40 - 20 = 20\\ |B \cap C| & = \left\lfloor \frac{200}{3 \cdot 5} \right\rfloor = 13\\ |A \cap B \cap C| & = 13 - \left\lfloor \frac{200}{2 \cdot 3 \cdot 5} \right\rfloor = 7 \end{align*} where we obtain $$|A \cap B|$$ by subtracting the number of even multiples of $$3$$ less than or equal to $$200$$ from the number of positive integer multiples of $$3$$ which are at most $$200$$, $$|A \cap C|$$ by subtracting the number of even multiples of $$5$$ less than or equal to $$200$$ from the number of positive integer multiples of $$5$$ which are at most $$200$$, and $$|A \cap B \cap C|$$ by subtracting the number of even multiples of $$3$$ and $$5$$ less than or equal to $$200$$ from the number of positive integer multiples of $$3$$ and $$5$$ less than or equal to $$200$$.

Hence, by the Inclusion-Exclusion Principle, the number of positive integers less than or equal to $$200$$ which are odd or divisible by $$3$$ or divisible by $$5$$ is $$100 + 66 + 40 - 33 - 20 - 13 + 7 = 147$$

• Thankyou so much for the clear explanation!! – kili Feb 12 at 19:28

There is a simplier way to count the number.

First let separate the even and odd numbers. There are $$100$$ odd numbers between $$1$$ and $$200$$. All of them are part of the answer. We will continue only with even number. We will use the inclusion-exclusion principle, as you did.

How many even number between $$2$$ and $$200$$ are divisible by $$3$$? Every third number is divisible by $$3$$ ( divisible by $$6$$, actually). $$\left\lfloor\frac{200}6\right\rfloor=33$$ How many even number between $$2$$ and $$200$$ are divisible by $$5$$? Every fifth number is divisible by $$5$$ ( divisible by $$10$$, actually). $$\left\lfloor\frac{200}{10}\right\rfloor=20$$ We counted twice the even numbers that where divisible by $$15$$. How many even number between $$2$$ and $$200$$ are divisible by $$15$$? Every fifteenth number is divisible by $$15$$ ( divisible by $$30$$, actually). $$\left\lfloor\frac{200}{30}\right\rfloor=6$$ Final answer $$100+33+20-6=147$$

My answer is one more than yours. You have a mistake in your last intersection. Your formula $$|A_1\cap A_2\cap A_3|=\left\lfloor\frac{200}{2\cdot3\cdot5}\right\rfloor$$ counts how many are divisible by $$30$$, but we need how many have a remainder of $$15$$ when divided by $$30$$. And there is one more. It could calculated like this. $$|A_1\cap A_2\cap A_3|=\left\lfloor\frac{200-15}{2\cdot3\cdot5}\right\rfloor+1$$ Substract $$15$$ to every numbers and forget the negative ones. We now have $$185$$ numbers. How many are divisible by $$30$$? We add one to count the number $$15$$ (which became $$0$$ and wasn't accounted for).

• Thanyou so much but why my answer is incorrect? I assume that odd number is 100 in the sets – kili Feb 12 at 11:09
• I edited my answer. You counted the numbers divisible by $30$, but we wanted the odd numbers divisible by $15$. There is one more of the second group. – Alain Remillard Feb 12 at 11:15

In this simple case you don't really need the Inclusion/Exclusion principle $$-$$ you can do it 'by hand'.

First, count the even numbers between $$1$$ and $$30$$ that are divisible by $$3$$ or $$5$$: these are $$6,10,12,18,20,24,$$ and $$30$$. So there are $$7$$ of them. (Or you could use Inclusion/Exclusion on this part only: $$\frac{30}{6}+\frac{30}{10}-\frac{30}{30}=7$$.)

Next, note that this pattern repeats exactly every $$30$$ numbers; so between $$1$$ and $$210$$, there are $$49$$ of them. Subtract $$204$$ and $$210$$ to get $$47$$ between $$1$$ and $$200$$.

Now add the odd numbers to get $$147$$.

• Thankyou so much!! – kili Feb 12 at 19:28