计算大数的模
请问
如何计算2^301 mod 77?我确实查看了链接StackOverflow。但不明白625 mod 221 = 183 mod 221的步骤。转换是如何发生的?
All,
How can I calculate 2^301 mod 77? I did check out the link StackOverflow. But did not understand the step wherein 625 mod 221 = 183 mod 221. How did the conversion take place?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请查看此处的问题以获得答案对于你的问题。
基本上,
(X * Y) % Z == ((X % Z) * (Y % Z)) % Z
。因此,作为起点,
2^301 % 77 == ((2^150 % 77) * (2^151 % 77)) % 77
。继续分裂,直到获得合理的数字,然后重新组合。您将能够在整个过程中将您的数字保持在合理的大小。Take a look at the question here for an answer to your question.
Basically,
(X * Y) % Z == ((X % Z) * (Y % Z)) % Z
.So, as a starting point,
2^301 % 77 == ((2^150 % 77) * (2^151 % 77)) % 77
. Keep splitting until you have reasonable numbers, then recombine. You will be able to keep your numbers at a reasonable size the whole way through.我不明白你帖子的第二部分,可能是因为你没有包含你实际点击的链接。但是您的问题可以通过阅读此页面并实现正确的模幂算法来解决
I don't understand the second part of your post, probably because you didn't include the link you actually followed. But your problem can be solved reading this page and implementing a proper algorithm of modular exponentiation