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

Zimmermann Paul Paul.Zimmermann at
Thu Apr 11 20:37:07 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.*

indeed, see
The Tonelli–Shanks algorithm is so useful in many applications, that it
would make sense to have it implemented in GMP.


More information about the gmp-discuss mailing list