  Let $a_0=b_0=0$ and $0<a_1\leq b_1<a_2\leq b_2<\ldots\leq b_{n}$ be integers.
Let $Q\left(x;\bigcup_{j=1}^{n}[a_j,b_j]\right)$ be the number of integers
between $1$ and $x$ such that all exponents in their prime factorization are in
$\bigcup_{j=1}^{n}[a_j,b_j]$. The following formula holds:
$$\lim_{x\to\infty}{\frac{Q\left(x;\bigcup_{j=1}^{n}[a_j,b_j]\right)}{x}}=\prod\limits_{p}\sum\limits_{i=0}^{n}\left(\frac{1}{p^{a_{i}}}-\frac{1}{p^{b_{i}+1}}\right).$$
In this paper, we prove this result and then generalize it.
