如何找到大量muliplication模100000007 [英] how to find muliplication of large numbers modulo 100000007

查看:241
本文介绍了如何找到大量muliplication模100000007的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我们所知1000000007是一个大素数。
我如何才能找到两个大数的乘法模1000000007

As we know 1000000007 is a large prime number. How can I find multiplication of two large numbers modulo 1000000007

例如,如果我想找到78627765 * 67527574mod1000000007,我怎么能做到这一点。

For example if I want to find 78627765*67527574 mod 1000000007, how can I do it.

至少如果有人告诉我,我的程序应尽量

At least if anyone tell me the procedure I shall try

请注意:请让我知道有如int,long或long long基本数据类型的解决方案
在此先感谢

Note: pls let me know the solution with primitive datatypes like int,long or long long Thanks in advance

推荐答案

模链接的作品与那些推你的数字补偿空间的限制合理的数字:

Modulo chaining works with reasonable numbers that are pushing the limits of your numerical comp-space:

(A * B) % C == ((A % C) * (B % C)) % C.

这个证明是pretty直线前进,有数以千计的关于密码的网站在世界各地的例子。一个简单的例子:

The proof for this is pretty straight forward and there are literally thousands of examples on cryptography websites all over the world. A simple sample:

(7 * 8)%5 = 56%5 = 1

(7 * 8) % 5 = 56 % 5 = 1

((7 % 5) * (8 % 5)) % 5 = (2 * 3) % 5 = 6 % 5 = 1

我希望这有助于。显然,当A和B都已经被推到您的最高端平台的限制,但仍小于C,它变得毫无意义,但它可以很方便的时候不是这种情况下(即当A> C和/或B> C )。

I hope this helps. Obviously when A and B are already pushed to your top-end platform limits and are still smaller than C, it gets pointless, but it can be very handy when this is not the case (I.e. when A > C and/or B > C).

这篇关于如何找到大量muliplication模100000007的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆