小编典典

查找小于x的最大素数的算法

algorithm

如何计算小于值x的最大质数?

实际上,它不必精确,只需近似并接近x。

x是32位整数。

这个想法是x是一个配置参数。我正在使用小于x(称为y)的最大质数作为类构造函数的参数。值y必须是质数。


阅读 499

收藏
2020-07-28

共1个答案

小编典典

一些好的信息在这里的功能PI(X)。显然,

pi(x) = the number of primes less than x

你可以近似pi(x)

x/(log x - 1)

the n-th prime of that list of primes is equal to approximately n(log n)
2020-07-28