Click or drag to resize
AdvancedIntegerMathPowMod Method
Computes a power of an integer in modular arithmetic.

Namespace:  Meta.Numerics.Functions
Assembly:  Meta.Numerics (in Meta.Numerics.dll) Version: 3.1.0.0 (3.1.0.0)
Syntax
public static int PowMod(
	int b,
	int e,
	int m
)

Parameters

b
Type: SystemInt32
The base, which must be positive.
e
Type: SystemInt32
The exponent, which must be positive.
m
Type: SystemInt32
The modulus, which must be positive.

Return Value

Type: Int32
The value of be mod m.
Exceptions
ExceptionCondition
ArgumentOutOfRangeExceptionb, e, or m is not positive.
Remarks

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

See Also