proposal to change the return type/value of mpz_primorial_ui

Shane Neph sjneph at
Sat Nov 6 21:29:05 UTC 2021

That would be a nice solution.

On Sat, Nov 6, 2021 at 1:31 PM Marco Bodrato <bodrato at> wrote:
> Ciao,
> 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
> only.
> 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
> Ĝis,
> m
> --

More information about the gmp-devel mailing list