The smallest invariant factor of the multiplicative group
Let $λ_1(n)$ denote the least invariant factor in the invariant factor decomposition of the multiplicative group $M_n = (\mathbb Z/n\mathbb Z)^\times$. We give an asymptotic formula, with order of magnitude $x/\sqrt{\log x}$, for the counting function of those integers $n$ for which $λ_1(n)\ne2$. We also give an asymptotic formula, for any even $q\ge4$, for the counting function of those integers $n$ for which $λ_1(n)=q$. These results require a version of the Selberg-Delange method whose dependence on certain parameters is made explicit, which we provide in an appendix. As an application, we give an asymptotic formula for the counting function of those integers $n$ all of whose prime factors lie in an arbitrary fixed set of reduced residue classes, with implicit constants uniform over all moduli and sets of residue classes.