更新时间:2023-02-26 18:09:02
要生成M个质数,您需要上升到大约M logM。请参见
To generate M primes, you need to go up to about M log M. See Approximations for the nth prime number in this Wikipedia article about the Prime Number Theorem. To be on the safe side, you might want to overestimate -- say N = M (log M + 1).
编辑后添加:正如David Hammen指出的那样,这种高估并不总是足够好。 Wikipedia文章将M(log M + log log M)作为M> = 6的安全上限。
Edited to add: As David Hammen points out, this overestimate is not always good enough. The Wikipedia article gives M (log M + log log M) as a safe upper bound for M >= 6.