[Math] Counting 3-digit integers divisible by 6 but not by 9

combinatoricsdivisibility

How many $3$-digit counting numbers are exactly divisible by $6$ but not exactly divisible by $9$? I was able to find the answer for $6$ using the formula $T_n=a+(n-1)d$ but not sure how to find the answer for $9$.

Best Answer

Let us count all three digit numbers which are divisible by six.

There are $\lfloor\frac{999}{6}\rfloor - \lfloor\frac{99}{6}\rfloor$ numbers between $100$ and $999$ (i.e. three digit numbers) which are divisible by six.

How many of these are "bad" and are divisible by nine as well? Well, these would be those numbers which are divisible by six and by nine. In other words, the ones that are divisible by $18$.

$\lfloor\frac{999}{18}\rfloor - \lfloor\frac{99}{18}\rfloor$ of them are bad.

Subtracting and computing the necessary arithmetic will give a final answer.


This answer makes use of the fact that the number of integers between $1$ and $n$ which are divisible by $k$ is $\lfloor\frac{n}{k}\rfloor$, implying that the number of integers between $m$ and $n$ with $m<n$ which are divisible by $k$ will be $\lfloor\frac{n}{k}\rfloor - \lfloor\frac{m-1}{k}\rfloor$