`

快速幂取模求a的b次方余c

阅读更多
tashj @ 2006-07-24 16:05

快速幂取模 计算 a^b mod c ?
(a x b) mod c=((a mod c) x b) mod c.
我们可以将 b先表示成就:
b=at2^t+at-1 2^t-1+……a02^0. (ai=[0,1]).
这样我们由 a^b mod c=(a^(at2^t+at-12^t-1+…a02^0)mod c.
然而我们求a^(2^(i+1))mod c=((a^(2^i))mod c)^2 mod c .求得。



http://tashj.yculblog.com/post.1353527.html
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics