Discrete Mathematics – Counting Integers Divisible by 7 or 11

discrete mathematicsdivisibilityinclusion-exclusion

This is a question in Kenneth Rosen's Discrete Mathematics textbook 6th edition. I haven't had trouble with any other counting problems regarding "how many numbers in range [x,y] have divisibility property Z?" My issue is I have no idea what Rosen is asking for, i.e. I don't understand the question because I don't know what he wants me to compute.

Therefore this is not a duplicate of this question (1) https://math.stackexchange.com/questions/588160/how-many-positive-integers-less-than-1000-are-divisible, since while the answer is given, it doesn't explain the language of the question and what is being computed. I have no idea why the number of integers divisible by 7 or 11 minus the number of integer divisible by 77 (11 and 7) is the answer to this question. Both of these values I've already computed correctly (in separate questions).

In context:
20. How many positive integers less than 1000
e) are divisible by exactly one of 7 and 11?

Thus my question is: what/which numbers am I supposed to count/compute?

Best Answer

Call the numbers we are looking for good. A number is good if it is divisible by $7$ but not by $11$, or divisible by $11$ but not by $7$. That's what "divisible by exactly $1$ of $7$ and $11$" means.

Let $a$ be the number of numbers from $1$ to $999$ which are divisible by $7$, and let $b$ be the number of numbers which are divisible by $11$. If we add $a$ and $b$, we will have counted the numbers that are divisible by both $7$ and $11$ twice. However, we should not have counted them at all, they are not good.

So to get the count of the good numbers, we should find $a+b$, and take away twice the number of numbers that are divisible by both $7$ and $11$, like $77$, $154$, and a number of others.

Now the counts are straightforward. Let's find $a$. So we are counting the numbers $7\cdot 1$, $7\cdot 2$, $7\cdot 3$, and so on. What is the biggest $k$ such that $7\cdot k\le 999$? Note that $\frac{999}{7}\approx 142.71$. So the biggest integer $k$ such that $7\cdot k\le 999$ is $142$. It follows that $a=142$.

Finding $b$, and finding the number of numbers $\le 999$ divisible by $77$ is done similarly.