# Documentation

### This is machine translation

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

# `numlib`::`sqrtmodp`

Square root of a quadratic residue modulo a prime

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```numlib::sqrtmodp(`a`, `p`)
```

## Description

`numlib::sqrtmodp(a, p)` computes a solution x to the congruence .

`numlib::sqrtmodp(a, p)` computes an integer x that satisfies .

`a` must be a quadratic residue modulo `p`, and `p` must be a prime. This is not checked! Unless this is known to be the case, `numlib::msqrts` must be used. On the other hand, `numlib::sqrtmodp` is faster than `numlib::msqrts`.

## Examples

### Example 1

One square root of 132132 modulo 3231227 is 3012020:

`numlib::sqrtmodp(132132,3231227)`

## Parameters

 `a` An integer `p` A prime unequal to 2

## Return Values

`numlib::sqrtmodp` returns an integer.

## Algorithms

`numlib::sqrtmodp` uses D. Shanks' algorithm RESSOL.