Modular Arithmetic

Quotients and remainders, primitive roots, orders of residue classes, Euler's totient function, and more


MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

To convert a MuPAD notebook file to a MATLAB live script file, see convertMuPADNotebook. MATLAB live scripts support most MuPAD functionality, although there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

MuPAD Functions

divInteger part of a quotient
modModulo operator
modpPositive modulo function
modsSymmetric modulo function
numlib::isquadresTest for quadratic residues
numlib::orderOrder of a residue class
numlib::primrootPrimitive roots
numlib::reconstructRationalRational number reconstruction
numlib::sqrtmodpSquare root of a quadratic residue modulo a prime
powermodCompute a modular power of a number or a polynomial
remRemainder after division


Modular Arithmetic

Computing the quotient and the remainder of the division of two integers is a common operation in number theory.