BigInteger::ModPow Method (BigInteger, BigInteger, BigInteger)

 

Performs modulus division on a number raised to the power of another number.

Namespace:   System.Numerics
Assembly:  System.Numerics (in System.Numerics.dll)

public:
static BigInteger ModPow(
	BigInteger value,
	BigInteger exponent,
	BigInteger modulus
)

Parameters

value
Type: System.Numerics::BigInteger

The number to raise to the exponent power.

exponent
Type: System.Numerics::BigInteger

The exponent to raise value by.

modulus
Type: System.Numerics::BigInteger

The number by which to divide value raised to the exponent power.

Return Value

Type: System.Numerics::BigInteger

The remainder after dividing valueexponent by modulus.

Exception Condition
DivideByZeroException

modulus is zero.

ArgumentOutOfRangeException

exponent is negative.

The ModPow method evaluates the following expression:

(baseValue ^ exponent) Mod modulus

To perform exponentiation on BigInteger values without modulus division, use the Pow method.

The following example provides a simple illustration of calling the ModPow method.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 4.0
Windows Phone
Available since 8.1
Return to top
Show: