mpz_perfect_power companion

Seth Troisi braintwo at gmail.com
Tue Mar 26 20:09:43 UTC 2019


Add companion for mpz_perfect_power_p that returns the exponent and
optionally the root. Possible name mpz_rootexact. Marco suggested some
alternative functions, which could test a number and extract its nth power.
(Sept/Oct 2012).
I saw this item under "list of planned GMP improvements"
<https://gmplib.org/devel/GMPng.html> and it sounded like something I could
tackle.

I have experience using gmp and writing C++ code but not a lot of
experience writing clean performant C code. It would be nice to confirm
that the current maintainers have time to review (and help improve) patches
that I'd be writing.

I thought a good first step would be to add support for the two related
functions (mpz_perfect_power_p, mpz_perfect_square_p) in tune/speed which I
already started on.
https://github.com/sethtroisi/libgmp/pull/1/files
https://patch-diff.githubusercontent.com/raw/sethtroisi/libgmp/pull/1.patch

Let me know if this sounds reasonable,
Seth


More information about the gmp-devel mailing list