阅读背景:

有人能用简单的术语来解释这个Miller-Rabin Primality测试伪代码吗?

来源:互联网 

Here it is...

这里是……

Input: n > 3, an odd integer to be tested for primality;
Input: k, a parameter that determines the accuracy of the test
Output: composite if n is composite, otherwise probably prime
Write n − 1 as (2^s)·d with d odd by factoring powers of 2 from n − 1
WitnessLoop: repeat k times:
   pick a random integer a in the range [2, n − 2]
   x ← a^d mod n
   if x = 1 or x = n − 1 then do next WitnessLoop
   repeat s − 1 times:
      x ← x^2 mod n
      if x = 1 then return composite
      if x = n − 1 then do next WitnessLoop
   return composite
return probably prime
Input: n > 3, an odd in



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: