proposal to change the return type/value of mpz_primorial_ui

Marco Bodrato bodrato at
Sat Nov 6 20:31:07 UTC 2021


Il 2021-11-03 19:18 Shane Neph ha scritto:
> mpz_primorial_ui( ) is a great function.  Why not return the actual
> number of primes that go into that calculation?

It may make sense, but only if we add also another function: a way to
compute the number of primes in a range; or at least in the
range [1..n], i.e. pi(n) for a given unsigned long n.

Without that function, the only way to compute pi(n) in GMP would be:
compute primorial(n), discard the result, and take the return value 

Such a function does not belong to any of the mp[nzfq] layers...
Can the prototype be something like the following?

long gmp_pi_ui(unsigned long n);

Of course, in this area GMP shall not claim to be the
faster available library ;-D



More information about the gmp-devel mailing list