Calcuate (a/b) mod p when p is not prime

Правка en1, от dragneel3131, 2017-11-08 15:53:36

I have to calculate the value of (a/b) mod p where p may or may not be a prime number. For p being prime, I can simply find (b inverse for mod p) using euclid theorem or little fermat theorem, and perfrom (a * inverse(b)) % p. But in case p is not prime, how can I find the solution? I think there is a method by doing prime factorization of p and then using chineese remainder theorem but not sure about it. Can anyone help how can I solve this problem?

a and b both are less than p.

Теги number theory

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский dragneel3131 2017-11-08 15:53:36 532 Initial revision (published)