## `numlib::msqrts` -- modular square roots

#### Introduction

`numlib::msqrts``(a,m)` returns the list of all integers 0 <= x <= m-1 such that (x^2-a) mod m = 0.

#### Call(s)

`numlib::msqrts(a, m)`

#### Parameters

`a` | - | an integer
`m` | - | a natural number relatively prime to `a`

#### Returns

`numlib::msqrts``(a,m)` returns a list of nonnegative integers

#### Related Functions

`numlib::lincongruence`, `numlib::mroots`

#### Details

- `numlib::msqrts``(a,m)` returns the function call with evaluated arguments if one of the arguments is not a number.
- `numlib::msqrts` returns an error if the arguments evaluate to numbers which are not both of the correct type.

#### Example 1

Computing the square roots of modulo :

    >> numlib::msqrts(132132,3231227)

                                 [219207, 3012020]

#### Example 2

There are no square roots of modulo :

    >> numlib::msqrts(222222,324899)

                                        []

#### Example 3

Computing the square roots of modulo :

    >> numlib::msqrts(37,48884)

               [383, 585, 23857, 24059, 24825, 25027, 48299, 48501]

#### Background

- `numlib::msqrts` uses D. Shanks' algorithm RESSOL.

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