How many three digit numbers are not divisible by 3, 5 or 11?

How many three digit numbers are not divisible by 3, 5, or 11?

How can I solve this?

Should I look to the divisibility rule or should I use, for instance, $$ \frac{999-102}{3}+1 $$


Solution 1:

Assuming that you mean by either $3$ or $5$ or $11$, use inclusion/exclusion principle:

  • Amount of numbers with at most $3$ digits that are not divisible by $3$ or $5$ or $11$:

    $999-\lfloor\frac{999}{3}\rfloor-\lfloor\frac{999}{5}\rfloor-\lfloor\frac{999}{11}\rfloor+\lfloor\frac{999}{3\times5}\rfloor+\lfloor\frac{999}{3\times11}\rfloor+\lfloor\frac{999}{5\times11}\rfloor-\lfloor\frac{999}{3\times5\times11}\rfloor=485$

  • Amount of numbers with at most $2$ digits that are not divisible by $3$ or $5$ or $11$:

    $99-\lfloor\frac{99}{3}\rfloor-\lfloor\frac{99}{5}\rfloor-\lfloor\frac{99}{11}\rfloor+\lfloor\frac{99}{3\times5}\rfloor+\lfloor\frac{99}{3\times11}\rfloor+\lfloor\frac{99}{5\times11}\rfloor-\lfloor\frac{99}{3\times5\times11}\rfloor=48$

  • Amount of numbers with exactly $3$ digits that are not divisible by $3$ or $5$ or $11$:

    $485-48=437$

Solution 2:

A simple approach I like is the Inclusion-exclusion principle.

Let $C_{[i1, i2,...]}$ mean number of three digit numbers divisible by i1, i2, ... and $C$ the number of three digit numbers. So we have:

$C - C_{[3]} - C_{[5]} - C_{[11]} + C_{[3, 5]} + C_{[3, 11]} + C_{[5, 11]} - C_{[3, 5, 11]}$

For each $C_{[i_1, i_2, ...]}$ we have:

$C_{[i_1, i_2, ...]} = \lfloor\frac{999}{i_1 * i_2 *...}\rfloor - \lfloor\frac{99}{i_1 * i_2 *...}\rfloor$

This results in $900 - (300 + 180 + 81) + (60 + 27 + 17) - 6 = 437$

Note:

I assume you mean "How many three digit numbers are not divisible by 3,5 or 11?"

Otherwise your answer is $\lfloor\frac{999}{3*5*11}\rfloor - \lfloor\frac{99}{3*5*11}\rfloor = 6$

Solution 3:

One can compute the required exclusions/inclusions quickly and avoid having to deal with floor function by going about it as below:

Numbers from 1 to 990 not divisible by $3, 5$ or $11$ = $990(1-\frac{1}{3})(1-\frac{1}{5})(1-\frac{1}{11})$ = 480

One can count that from 991 to 999 there are 5 such numbers.

Total numbers between 1 - 999 => $485$

Total numbers from 1 to 99 not divisible by $3,5$ or $11$ = $99(1-\frac{1}{3})(1-\frac{1}{5})(1-\frac{1}{11})$ = 48

Total 3 digit numbers not divisible by $3, 5$ or $11$ = $485 - 48$ = $437$