are there any functions for computing a square root of a modulo p (prime)?

David Gillies daggillies at
Thu Apr 11 20:16:51 CEST 2013

*There's no API functions to calculate quadratic residues directly but you
do have mpz_legendre() so all the tools are there to calculate it even for
p = 1 mod 8. It's not deterministic though.*

On Thu, Apr 11, 2013 at 11:42 AM, Ramón T. B. <framontb at> wrote:

> Hello,
>   I would like to know if there are any functions to compute a square root
> (Modular arithmetic) for a number, say 'a', modulo a prime number, say 'p'
> (prime). I mean, to solve the congruence  x² ≡ a mod p
> Thanks in advance: framontb
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at

David Gillies
San Jose
Costa Rica

More information about the gmp-discuss mailing list