Suppose $n\mathbb{Z} = \{0, n,−n, 2n,−2n, . . .\}$ and $I_n = n\mathbb{Z} \cap [1, 1000]$. Question: Suppose $n\mathbb{Z} = \{0, n,−n, 2n,−2n, . . .\}$ and $I_n = n\mathbb{Z} \cap [1, 1000]$. How many elements are contained in the
set $I_6 \cup I_{15} \cup I_{25}$?
Answer: The answer is $226$.
Here is what I tried. Is this correct?
$\left \lfloor{\frac{1000}{6}}\right \rfloor=166$
$\left \lfloor{\frac{1000}{15}}\right \rfloor=66$
$\left \lfloor{\frac{1000}{25}}\right \rfloor=40$
$166+66+40=272$
$\left \lfloor{\frac{1000}{\text{lcm}(6,15)}}\right \rfloor=\left \lfloor{\frac{1000}{30}}\right \rfloor=33$
$\left \lfloor{\frac{1000}{\text{lcm}(6,25)}}\right \rfloor=\left \lfloor{\frac{1000}{150}}\right \rfloor=6$
$\left \lfloor{\frac{1000}{\text{lcm}(15,25)}}\right \rfloor=\left \lfloor{\frac{1000}{75}}\right \rfloor=13$
$33+6+13=52$
$\left \lfloor{\frac{1000}{\text{lcm}(6,15,25)}}\right \rfloor=\left \lfloor{\frac{1000}{150}}\right \rfloor=6$
$272-(52-6)=272-46=226$.
 A: The number of elements in $I_n$, which we will denote by $|I_n|$, is uniquely determined by the value of its largest element, which in turn is the largest integer multiple of $n$ not exceeding $1000$.  In particular, $$|I_n| = \left\lfloor \frac{1000}{n} \right\rfloor$$  so that we have $$|I_6| = 166, \\ |I_{15}| = 66, \\ |I_{25}| = 40.$$  But we would be double-counting some of these elements since for instance $(6)(15) = 90$ is included in both $I_6$ and $I_{15}$.  Adjusting for these leads us to the inclusion-exclusion formula $$|I_6 \cup I_{15} \cup I_{25}| = |I_6| + |I_{15}| + |I_{25}| - |I_6 \cap I_{15}| - |I_{15} \cap I_{25}| - |I_{25} \cap I_6| + |I_{6} \cap I_{15} \cap I_{25}|.$$  Since $$I_a \cap I_b = I_c$$ where $c = \operatorname{lcm}(a,b)$, we also need to compute $$I_{6} \cap I_{15} = I_{30}, \\ I_{15} \cap I_{25} = I_{75}, \\ I_{25} \cap I_6 = I_{150}, \\ I_{6} \cap I_{15} \cap I_{25} = I_{150}.$$  Consequently $$|I_6 \cup I_{15} \cup I_{25}| = 166 + 66 + 40 - (33 + 13 + 6) + 6 = 226.$$
