Dear Simon, > * Do you have any other suggestions on improving the code shown above? I would first compute the 2-valuation using mpz_scan1 for example, and then try to divide by 5^k, with k bounded by the 2-valuation. Best regards, Paul Zimmermann