slightly faster ``sqrt_mod_iter``