Feature request for function mpz_primorial_ui

Marco Bodrato bodrato at mail.dm.unipi.it
Sat Jan 26 09:46:16 UTC 2019


Il Ven, 18 Gennaio 2019 7:03 pm, Shane Neph ha scritto:
> This is a useful function.  Thank you for providing it.  Since it goes

You are welcome!

> through the trouble of finding and multiplying out all prime numbers <= n,
> it would be even better if it also returned an unsigned long int that
> gives the number of primes found and used in the calculation.

We may think about an interface for counting primes (only in the unsigned
long range?) or looping on them...
The feature you propose would not need a big effort, but it would require
a different interface, for this reason its adoption in the project can not
be assured.

For your experiments, you can get the current development library, from
the repository https://gmplib.org/repo/gmp/ or from a snapshot
https://gmplib.org/download/snapshot/ and apply the attached patch before
compiling and testing. It provides an mpz_primorial_ui function that
(also) returns the number of prime factors of the result. But beware, both
the LICENSE and the INTERFACE will be changed! (And the documentation will
not change accordingly :-/ )


-------------- next part --------------
A non-text attachment was scrubbed...
Name: nombranta_primorial.patch
Type: text/x-patch
Size: 5639 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-discuss/attachments/20190126/8be77648/attachment.bin>

More information about the gmp-discuss mailing list