This is machine translation

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


Order of a residue class

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.


numlib::order(a, m)


numlib::order(a,m) returns the order of the residue class modulo m of a in the group of units modulo m if a and m are coprime.

numlib::order(a,m) returns the function call with its arguments evaluated if a or m is not a number.

numlib::order returns an error if one of the arguments evaluates to a number of wrong type.


Example 1

We compute the order of the residue class of 23 in the unit group modulo 2161:

numlib::order(23, 2161)

Example 2

We compute the order of all elements in the unit group modulo 13:

map([$ 1..12],numlib::order,13)

Example 3

The residue class of 7 is not a unit in the ring modulo 21:




An integer


A natural number

Return Values

numlib::order(a,m) returns a natural number if a is coprime to m, and FAIL if a is not coprime to m.


numlib::order uses ifactor and numlib::phi.

See Also

MuPAD Functions

Was this topic helpful?