开发者

Help with modulo arithmetic

How do you solve something like 7Xd =(congruent to) 1 mod 40?

find the smallest d that satisfies开发者_StackOverflow社区 this equation


Euler's theorem suggests that if you raise 7 to a large enough power, you find D. Powers of seven mod 40 are 1, 7, 9, 23, 1, ..., so d is 23.

D is unique as 40 and 7 are coprime (as 7 is prime). If it weren't unique, there would be two d1, d2 such that d1 != d2 and d1*7 == 1 == d2*7 (mod 40), so some value (d2-d1)*7 mod 40 is zero. I'm not sure how a general case might be found.


Modulo is only half an arithmetic operation. It requires div to be complete. As such, you will get a range of possible answers. If I'm reading your question right. 7Xd doesn't mean anything to me - perhaps more info could get a better answer?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜