I'd love your help with understanding how should I compute the order of a number modulo some prime number $p$ without going through all of the options.
Let me explain:
I defined $\operatorname{ord}_p(a)= \min (i>0 | a^i=1(p))$. I know that for every prime $\varphi(p)=p-1$ where $\varphi(p)=|(\mathbb{Z} /_p\mathbb{Z})^x|$, but I look for the minimial i which satisfies the condition, but sometimes I have a big $p$ to work with, for example: the number 3 and the $p=29$. Is there any way to know what is $\operatorname{ord}(3)$ for this p without computing all the options $4,5,\ldots,28$? Is there any theorem which may help me with that and I'm missing it?
Thanks a lot!