It is well-known that a linear congruence $ax\equiv b\pmod{n}$ has solutions if and only if the gcd $d:=(a,n)$ divides $b$, and then it has exactly $d$ incongruent ones, namely, $x=x_0+t\frac{n}{d}$ for $t=0,\dots,d-1$. My question is how many of these $x$ are units of $\mathbb{Z}_n$, i.e., $(x,n)=1$?
More generally, one can ask how many (incongruent) units occur in the arithmetic sequence $x_0+td'$ with $d'\mid n$. When $d'=1$, the answer is all of them, i.e., the Euler's totient $\varphi(n)$. It cannot be $\varphi(\frac{n}{d'})$ in general because if $x_0$ has non-trivial common divisors with $d'$ the answer will be $0$, but maybe it is true when $(x_0,d')=1$? Has this question been studied? It comes up when counting elements in certain centralizers and conjugacy classes.