Accelerating the pace of engineering and science

# Documentation Center

• Trial Software

# numlib::order

Order of a residue class

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## Syntax

```numlib::order(a, m)
```

## Description

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.

## Examples

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

`numlib::order(7,21)`

## Parameters

 a An integer m 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.

## Algorithms

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