Question regarding GMP

Torbjorn Granlund tege at
Thu Jun 9 23:33:19 CEST 2005

John Zhang <johnz at> writes:

  Can you please tell me if there's a small primes generator in GMP
  4.1.4? "mpz_nextprime(...)" is relatively slow. Or direct me to
  someone who would know?

The performance of mpz_nextprime on GMP 4.1.4 is not good, in
particular for small numbers.  Since it is stateless, it isn't
possible to make it really fast.

I plan on optimizing mpz_nextprime, as well as introduce a new
mpz_nextprime2 that accepts a state structure.  There is actually
some commented-out code in mpz/nextprime.c that you might want to
test.  But be aware that it is not tested, or at least not well


More information about the gmp-discuss mailing list