I checked in some further mpz_powm_ui improvements. mpz_powm_ui is still probably slower tnan mpz_powm for say b^19 mod N when N is huge (> 2^100000). Deeper hacking is needed to make things ideal. See <http://gmplib.org/devel/>. -- Torbjörn