Accelerating the pace of engineering and science

# numlib::primroot

Primitive roots

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## Syntax

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

## Description

numlib::primroot(m) returns the least positive primitive root modulo m if there exist primitive roots modulo m.

numlib::primroot(a, m) returns the least primitive root modulo m not smaller than a if there exist primitive roots modulo m.

## Examples

### Example 1

We compute the least positive primitive root modulo the prime number 40487:

`numlib::primroot(40487)`

### Example 2

We compute the least primitive root modulo 404872 = 1639197169:

`numlib::primroot(1639197169)`

### Example 3

Now we compute least primitive root modulo 40487 which is >=111111111:

`numlib::primroot(111111111,40487)`

### Example 4

There are no primitive roots modulo 324013370:

`numlib::primroot(324013370)`

## Parameters

 a An integer m A natural number

## Return Values

numlib::primroot returns an integer or FAIL.

## Algorithms

numlib::primroot uses ifactor.