gpt4 book ai didi

algorithm - 用于测试确定性素数的 Miller-Rabin 的修改版本?

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:30:58 26 4
gpt4 key购买 nike

Miller-Rabin test使用 k 个随机整数来测试素数。

根据 CLRS,第 3rd 版,第 971 页:

Theorem 31.38

If n is an odd composite number, then the number of witnesses to the compositeness of n is at least (n - 1)/2.

那我们为什么不直接运行随机 k 次测试,而是使用不同 ( n - 1 )/2 个值并测试它们的素性?由于除 2 以外的所有素数都是奇数,并且没有见证人至少 ( n - 1 )/2 我们保证找到见证人(如果存在的话)。

最佳答案

运行时间从 poly(log(n)) 到 n*poly(log(n)),这对大数来说很糟糕,因为 n 比 log(n) 大得多。

关于algorithm - 用于测试确定性素数的 Miller-Rabin 的修改版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37659408/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com