1. ## Inclusion–exclusion principle

How many numbers that are less than 1000 000 are divisible by 7 but not divisible by 10,12,25?

2. ## Re: Inclusion–exclusion principle

Hello, Garas!

How many numbers that are less than 1,000,000 are divisible by 7
but not divisible by 10, 12, 25?

Every 7th number is divisible by 7:. $\left[\frac{999,999}{7}\right] \,=\,142,\!857$

But how many of these are also divisible by 10, 12, or 25?
. . This will take a little work . . .

$\begin{Bmatrix}\text{Div by 7 and 10:} & \left[\dfrac{999,\!999}{7\cdot10}\right] &=& 14,\!285 \\ \\[-3mm] \text{Div by 7 and 12:} & \left[\dfrac{999,\!999}{7\cdot12}\right] &=& 11,\!904 \\ \\[-3mm] \text{Div by 7 and 25:} & \left[\dfrac{999,\!999}{7\cdot25}\right] &=& 5,\!714 \end{Bmatrix} \quad\text{Total: }31,\!903$

$\begin{Bmatrix}\text{Div by 7, 10, 12:} & \left[\dfrac{999,999}{7\cdot60}\right] &-& 2,\!380 \\ \\[-3mm] \text{Div by 7, 12, 25:} & \left[\dfrac{999,999}{7\cdot300}\right] &=& 476 \\ \\[-3mm] \text{Div by 7, 10, 25:} & \left[\dfrac{999,999}{7\cdot50}\right] &=& 2,857 \end{Bmatrix} \quad\text{Total: }5,\!713$

$\begin{Bmatrix}\text{Div by 7, 10, 12, 25:} & \left[\dfrac{999,\!999}{7\cdot300}\right] &=& 476 \end{Bmatrix} \quad\text{Total: } 476$

$\text{There are: }\,31,\!903 - 5,\!713 + 476 \:=\:26,\!666\text{ multiples of 7}$
. . . . . . . . $\text{which are also divisible by 10, 12, or 25.}$

$\text{The answer is: }\:142,\!857 - 26,\!666 \;=\;116,\!191$