Do modulus division on a BigInteger raised to the power of another number in CSharp
Description
The following code shows how to do modulus division on a BigInteger raised to the power of another number.
Example
/* w w w . j a v a 2 s. co m*/
using System;
using System.Numerics;
public class Class1
{
public static void Main()
{
BigInteger number = 10;
int exponent = 3;
BigInteger modulus = 30;
Console.WriteLine("({0}^{1}) Mod {2} = {3}",
number, exponent, modulus,
BigInteger.ModPow(number, exponent, modulus));
}
}
The code above generates the following result.