2

Can someone tell me the efficient way to solve this problem ?

abc mod m

a, b, c, and m are 32 bit int

where m is not a prime number and a is not coprime to m?I've looking for the answer, but haven't found it There are some answered questions that familiar with this question, but none of them can explain my problem. Remember if

abc mod m != abc mod m

11
  • 2
    cs.stackexchange.com is probably a better place for this question.
    – R Sahu
    Nov 12, 2014 at 16:42
  • This question appears to be off-topic because cs.stackexchange.com is a better place for this question.
    – R Sahu
    Nov 12, 2014 at 16:44
  • 5
    It's not really a duplicate of the pow question. The common problem is computing this without overflow. Nov 12, 2014 at 16:46
  • Thanks hatchet for spotting the main issue. +1
    – fjardon
    Nov 12, 2014 at 16:47
  • 1
    So what you want is not just a ModPow function, but a ModPowPow function. Nov 12, 2014 at 16:52

0

Browse other questions tagged or ask your own question.