If $n= \prod_{i=1}^{m} p_i$, all $p_i$ pairwise distinct, then number of coprimes below $n$ is $\prod_{i=1}^{m} (p_i-1)$.
For example with $m=2$, there are $p_2-1$ multiples of $p_1$ below $n$ and similarly there are $p_1-1$ multiples of $p_2$ below $n$, so $(p_1p_2-1)-(p_1-1)-(p_2-1) = (p_1-1)(p_2-1)$ counts the number of coprimes below $n$.
Now let $s_{i}$ count the multiples of $p_i$ below $n$ that are not multiples of $p_j$ for $j\ne i$. Similarly define the value $s_{i_1,i_2,\cdots}$ to count the multiples of $p_{i_1},p_{i_2},\cdots$ that are not multiples of other $p_j$s below $n$.
Then number of coprimes is given by
For $m=2$: $\quad(p_1p_2-1)-(s_1+s_2)$
For $m=3$: $\quad(p_1p_2p_3-1)-(s_1+s_2+s_3+s_{1,2}+s_{1,3}+s_{2,3})$
and so on. Is there any formula to calculate $s_{i_1,i_2,\cdots,i_k}$ in terms of $p_i$s?
Let $P$ be the set of prime divisors of $n$, and let $S\subseteq P$ be any subset. The number of $k$ that are in the range $1\le k<n$ which are multiples of primes in $P$ but not any other primes in $S$ is given by
$$n\left[\prod_{p\in S}\frac{1}{p}\right]\left[\prod_{q\in P\setminus S}\left(1-\frac{1}{q}\right)\right]. \tag{$\circ$}$$
Suppose $\ell_1$, $\ell_2$, $\cdots$ are prime divisors of $r$. If we draw numbers $x\in\{1,\cdots,r\}$ uniformly, the events $\ell_1\mid x$, $\ell_2\mid x$, $\cdots$ are independent. This means that $P(\ell_{i_1},\cdots,\ell_{i_t}\mid x)=\prod_{j=1}^t P(\ell_{i_j}\mid x)$.
Hence with $r=n$ and all prime divisors we may conclude
$$P(p\mid x~\textrm{for all }p\in S\textrm{ and }q\nmid x\textrm{ for all }q\in P\setminus S)=\prod_{p\in S}P(p\mid x)\prod_{q\in P\setminus S}P(q\nmid x).$$
Writing $P(p\mid x)=\frac{1}{p}$ and $P(q\nmid x)=1-\frac{1}{q}$ and multiplying by $n$, we obtain $(\circ)$.