An Interesting problem related to modulo arithmetic

Правка en2, от code_warrior, 2020-11-17 10:58:21

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.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский code_warrior 2020-11-17 11:09:47 1 Tiny change: '(1<k<=p-1)find the m' -> '(1<k<=p-1) find the m'
en2 Английский code_warrior 2020-11-17 10:58:21 6
en1 Английский code_warrior 2020-11-17 10:57:53 539 Initial revision (published)