1

I encountered two types of Miller Rabin primality test methods suddenly. One which uses randoms and another does not use randoms.

Is there a hidden random generation inside the second one or what? Thank you.

4

1 回答 1

2

第二个是米勒-拉宾素性检验的确定性变体。代替使用从随机数生成的“见证”数,而是使用已知足够的素数列表:

当要测试的数量 n 很小时,没有必要尝试所有 a < 2(ln n)2,因为已知更小的潜在证人集就足够了"

如果 n < 3,825,123,056,546,413,051,则测试 a = 2、3、5、7、11、13、17、19 和 23 就足够了。

alist这是链接源代码中的素数列表。

于 2016-12-08T21:25:31.467 回答