mpz_invert() limit?

Zimmermann Paul Paul.Zimmermann at
Tue May 22 15:38:10 CEST 2012

> Date: Tue, 22 May 2012 13:32:20 +0100
> From: Sam Kennedy <samstauk at>
> I've been using the mpz_invert() function as part of my RSA key generator,
> however if the values get much more than 9-10 digits long, the function
> returns an incorrect value.
> Is there a limit to the size of the numbers you can use with mpz_invert()?
> If so, what is that limit?
> Is there a way around it?
> Thank You,
> -Sam

I'm 99% sure the problem lies in your code. If you are confident the problem
is within GMP, please send a sample program showing the problem.

Paul Zimmermann

More information about the gmp-discuss mailing list