Given a prime $p$ and number $a$ isn't divided by $p$, how do I find the smallest positive integer number $n$ such that $a^n≡1\pmod p$?
Example for $a=10; p=13$; $n$ would be $6$.
Is there an algorithms that faster than brute-force with $O(p)$?
Given a prime $p$ and number $a$ isn't divided by $p$, how do I find the smallest positive integer number $n$ such that $a^n≡1\pmod p$?
Example for $a=10; p=13$; $n$ would be $6$.
Is there an algorithms that faster than brute-force with $O(p)$?