about prime number generation

Hans Åberg haberg-1 at telia.com
Fri May 20 14:31:32 CEST 2022

> On 30 Apr 2022, at 14:31, Garcia Moreno-Esteva, Enrique <enrique.garciamoreno-esteva at helsinki.fi> wrote:
> I apologize this is not a comment about your webpage, but more a question about your library. Would your library contain a function (call it p(n) ) that generates the n-th prime? If it does not, alternatively, do you have a lower bound for  certifiably producing the next prime with the nextprime function in your library (it is probabilistic, but such probabilistic methods are deterministic below certain bounds, so my question is, what is the lower bound for your function)?

Some inputs:

Page that mentions Sieve of Atkin that runs in O(n) time, better than Eratosthenes O(n log log n):

Also see the article:

For large numbers, there is suggestion here to start with a guess and find an exact value for a nearby value, and then sieve to the asked for value, but I am not sure how this works in practise:

Programs that implements it using a sieve:

More information about the gmp-discuss mailing list