Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

numlib::legendre

Legendre symbol

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

numlib::legendre(a, p)

Description

numlib::legendre(a, p) returns the Legendre symbol (a | p).

numlib::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.

Examples

Example 1

Computing the Legendre symbol (132132 | 3231277):

numlib::legendre(132132,3231227)

Example 2

Computing the Legendre symbol (132131 | 3231277):

numlib::legendre(132131,3231227)

Example 3

Computing the Legendre symbol (-303 | 101):

numlib::legendre(-303,101)

Parameters

a

An integer

p

An odd prime

Return Values

numlib::legendre(a,p) returns -1, 0, 1, or the function call with evaluated arguments.

Algorithms

If p is an odd prime and if a is an integer divisible by p then by definition the Legendre symbol (a | p) is zero.

See Also

MuPAD Functions

Was this topic helpful?