BigInteger.ModPow(BigInteger, BigInteger, BigInteger) Método
Definição
Executa a divisão de módulo em um número elevado à potência de outro número.Performs modulus division on a number raised to the power of another number.
public:
static System::Numerics::BigInteger ModPow(System::Numerics::BigInteger value, System::Numerics::BigInteger exponent, System::Numerics::BigInteger modulus);
public static System.Numerics.BigInteger ModPow (System.Numerics.BigInteger value, System.Numerics.BigInteger exponent, System.Numerics.BigInteger modulus);
static member ModPow : System.Numerics.BigInteger * System.Numerics.BigInteger * System.Numerics.BigInteger -> System.Numerics.BigInteger
Public Shared Function ModPow (value As BigInteger, exponent As BigInteger, modulus As BigInteger) As BigInteger
Parâmetros
- value
- BigInteger
O número a ser elevado à potência exponent.The number to raise to the exponent power.
- exponent
- BigInteger
O expoente pelo qual value será elevado.The exponent to raise value by.
- modulus
- BigInteger
O número pelo qual dividir o value elevado à potência exponent.The number by which to divide value raised to the exponent power.
Retornos
O resto após dividir o valueexponente por modulus.The remainder after dividing valueexponent by modulus.
Exceções
modulus é zero.modulus is zero.
exponent é negativo.exponent is negative.
Exemplos
O exemplo a seguir fornece uma ilustração simples de chamar o ModPow método.The following example provides a simple illustration of calling the ModPow method.
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 example displays the following output:
// (10^3) Mod 30 = 10
Imports System.Numerics
Module Example
Public Sub Main()
Dim number As BigInteger = 10
Dim exponent As Integer = 3
Dim modulus As BigInteger = 30
Console.WriteLine("({0}^{1}) Mod {2} = {3}", _
number, exponent, modulus, _
BigInteger.ModPow(number, exponent, modulus))
End Sub
End Module
' The example displays the following output:
' (10^3) Mod 30 = 10
Comentários
O ModPow método avalia a seguinte expressão:The ModPow method evaluates the following expression:
(expoente de baseValue ^) Módulo mod(baseValue ^ exponent) Mod modulus
Para executar exponenciação em BigInteger valores sem divisão de módulo, use o Pow método.To perform exponentiation on BigInteger values without modulus division, use the Pow method.