Find the smallest $n$ with $(113^{13})^n \equiv 113 \bmod 155$
My thoughts:
Since the multiplicative ring $\mathbb{Z}_{155}$ has $155$ elements, then $a^{155}= 1$ for all $a \in \mathbb{Z}$
Hence $113^{155} \equiv 1 \bmod 155$
Then I noticed that $12 \cdot 13=155+1$ and hence $n=12$, but I don't know how to check this. Is this correct? Is there any algorithm to find $n$ in more complicated cases?