GMP function to generate prime number bigger than X

Hans Petter Selasky hps at
Wed Jan 26 14:06:41 CET 2022

On 1/26/22 13:58, Torbjörn Granlund wrote:
> Hans Petter Selasky <hps at> writes:
>    I didn't find any functions to quickly generate a prime number bigger
>    than X in GMP, so I made my own for now.
> What about mpz_nextprime?

Hi Torbjørn,

I haven't tried. Do you know if it is fast?

Basically I wanted to avoid the Miller Rabin test, because any prime 
will do, not just the next one.


More information about the gmp-discuss mailing list