gpt4 book ai didi

java - 澄清 isProbablePrime 中的确定性因子

转载 作者:搜寻专家 更新时间:2023-11-01 01:12:56 27 4
gpt4 key购买 nike

我的问题涉及 BigIntegerisProbablePrime() 方法的“确定性”因素。 Java API 声明这是:

"a measure of the uncertainty that the caller is willing to tolerate"

这是不确定性百分比还是其他因素。我需要 2 个 512 位的质数。

最佳答案

来自Javadocs for BigInteger's isProbablePrime method :

certainty - a measure of the uncertainty that the caller is willing to tolerate: if the call returns true the probability that this BigInteger is prime exceeds (1 - 1/2certainty)

因此,您传递的 certainty 数字越高,您就越确定,即 100 表示它是素数的概率为 1 - (1/2)100,非常接近 1。

Java 通过执行 Miller-Rabin 素数测试来实现这一点,其数量基于确定性(和 Lucas-Lehmer 测试)。

关于java - 澄清 isProbablePrime 中的确定性因子,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21740745/

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