I have the group $\mathbb{Z}_n^{\times}= \{\bar{a}\mid 1≤a≤n, \gcd(a,n)=1\}$ along with multiplication modulo $n$.
I understand how to find the inverse here, in this case. Here's my reasoning, please let me know if there's anything wrong.
Since $\gcd(a,n)=1 \iff \exists x,y \in \mathbb{Z}$ such that $ax + ny = 1 \iff \exists x \in \mathbb{Z}$ such that $ax \equiv 1 \ (\bmod n)$ hence the multiplicative inverse exists and it's $\bar{x}$. To find it, all I have to do is use Euclidean algorithm to find $x$ and $y$ that make the linear combination. Is this right?
Now for the next part, here's where I'm confused. How do I find the order of each member of that group? Again, $\gcd(a,n)=1$ so by Euler's theorem I have that $a^{\phi(n)}\equiv 1 \ (\bmod n)$ hence order of $a$ must be a divisor of $\phi(n)$. So for a small $\phi(n)$, I can manually calculate the order. However, I'm not sure what to do if $\phi(n)$ has lots of divisors. Surely, it is very impractical to check it manually for each divisor. Is there a nice short algorithm or a slick trick which can help calculate order faster, in exams, where I have about a minute or two for such questions?