AdvancedIntegerMathPowMod Method

Computes a power of an integer in modular arithmetic.

Definition

Namespace: Meta.Numerics.Functions
Assembly: Meta.Numerics (in Meta.Numerics.dll) Version: 4.2.0+6d77d64445f7d5d91b12e331399c4362ecb25333
C#
public static int PowMod(
	int b,
	int e,
	int m
)

Parameters

b  Int32
The base, which must be positive.
e  Int32
The exponent, which must be positive.
m  Int32
The modulus, which must be positive.

Return Value

Int32
The value of be mod m.

Remarks

Modular exponentiation is used in many number-theory applications, including primality testing, prime factorization, and cryptography.

Exceptions

ArgumentOutOfRangeExceptionb, e, or m is not positive.

See Also