numlib::legendre -- Legendre
symbol
Introductionnumlib::legendre(a, p) returns the
Legendre symbol (a|p).
Call(s)numlib::legendre(a, p)
Parametersa |
- | an integer |
p |
- | an odd prime |
Returnsnumlib::legendre(a,p) returns
-1, 0, 1, or the function call
with evaluated arguments.
Related
Functionsnumlib::jacobi,
numlib::isquadres
Detailsnumlib::legendre returns an error if one of its
arguments evaluates to a number of wrong type.numlib::legendre returns the function call with
evaluated arguments if at least one of its arguments does not evaluate
to a number.
Example
1Computing the Legendre symbol (132132 | 3231277):
>> numlib::legendre(132132,3231227)
1
Example
2Computing the Legendre symbol (132131 | 3231277):
>> numlib::legendre(132131,3231227)
-1
Example
3Computing the Legendre symbol (-303|101):
>> numlib::legendre(-303,101)
0
Background