Documentation Center

  • Trial Software
  • Product Updates

numlib::sqrtmodp

Square root of a quadratic residue modulo a prime

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

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.

See Also

MuPAD Functions

Was this topic helpful?