GMP has a function mpz_perfect_power_p() that for given integer a tells if a = x^y is solvable in integers x, y with y > 1. But I need to find the largest y for which this is true (and also finding x). One way to do this is to prime factor a and take the gcd of the exponents, but is there a faster method?