Is mpz_legendre defined for p=2?

Kevin Ryde user42@zip.com.au
Mon, 24 Feb 2003 08:30:43 +1000


"Andrew Friedley (CNS Student Support)" <saai@henon.cns.uni.edu> writes:
>
> Looking at the information on mpz_legendre() in the manual, it claims
> that it is only defined for p being an odd positive prime.

True, that's the definition for the legendre symbol.

> I have tried
> using mpz_legendre() with p=2 and it seems to work as expected, is this
> correct?

In the current implementation mpz_legendre, mpz_jacobi and
mpz_kronecker are all aliases for the one function (the kronecker
flavour).

So calling mpz_legendre with inputs outside its documented range
works, though of course if you really want an even denominator then
you should be calling mpz_kronecker, for which such things are
defined.