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::isquadres

Test for quadratic residues

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::isquadres(a, m)

Description

If the integer number a is a quadratic residue modulo the natural number mnumlib::isquadres(a,m) returns TRUE, and if a is a quadratic non-residue modulo mnumlib::isquadres(a,m) returns FALSE.

If a and m are not coprime numlib::isquadres(a,m) returns an error.

numlib::isquadres returns an error if the arguments evaluate to numbers which are not both of the correct type.

numlib::isquadres returns the function call with its arguments evaluated if the arguments do not evaluate to numbers.

Examples

Example 1

132132 is a quadratic residue modulo 3231227:

numlib::isquadres(132132, 3231227)

Example 2

222222 is a quadratic non-residue modulo 324899:

numlib::isquadres(222222,324899)

Example 3

37 is a quadratic residue modulo 48884:

numlib::isquadres(37,48884)

Parameters

a

An integer

m

A natural number coprime to a

Return Values

numlib::isquadres returns TRUE, FALSE, or the function call with its arguments evaluated.

Was this topic helpful?