Hello, freinds recently i was confronted with a problem which goes like this->
Given a positive odd prime number p and another positive integer k (1<k<=p-1)find the minimum value of m such that pow(k,m)%p=1.
One straight way of approaching this is to iterate untill we get what we need thus contributing a time complexity of O(p), but i fancy if there exists even a more efficient way to do so. Can anyone help me or give some clue of how to solve it in less than O(p) time complexity.