Recently I asked how to calculate the order of an element in $U_{27}=\mathbb{Z}_{27}^*$ (Multiplicative group of integers modulo $27$) (link). Problem is I still don't understand the material but I would like to explain what I know and what I don't. Tried to find some similar thread on the same topic and I found the following tread (link). Although it does not answer my question directly, it points into that direction. I know the hard way to find the order of an element in $U_{27}$. For example in order to find the order of $5$ in $U_{27}$ I would do: $$\begin{align*} 5&=5\bmod 27=5\\ 5^2&=25\bmod 27=25\\ 5^3&=125\bmod 27=17 \end{align*}$$
And so on, until I find $n\in\mathbb{N}$ so $5^n=1$. It could take awhile, in fact I know that the order of $5$ in $U_{27}$ is $18$ ($5^{18}=3814697265625(mod27)=1$), so I will have to calculate $18$ times and facing some big numbers. I think that there is a fast way using the euler function. How can I use it in my advantage? is there a formula?