## `numlib::order` -- order of a residue class

#### Introduction

`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.

#### Call(s)

`numlib::order(a, m)`

#### Parameters

`a` | - | an integer
`m` | - | a natural number

#### Returns

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

#### Related Functions

`numlib::lambda`, `numlib::phi`

#### Details

- `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 in the unit group modulo :

    >> numlib::order(23, 2161)

                                       2160

#### Example 2

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

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

                     [1, 12, 3, 6, 4, 12, 12, 4, 3, 6, 12, 2]

#### Example 3

The residue class of 7 modulo isn't a unit in the ring :

    >> numlib::order(7,21)

                                       FAIL

#### Background

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

#### Changes

- no changes

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000