BigInteger.ModPow(BigInteger, BigInteger, BigInteger) Método

Definición

Realiza una división de módulo en un número elevado a la potencia de otro número.

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

Número que se va a elevar a la potencia especificada por exponent.

exponent
BigInteger

Exponente al que se va a elevar value.

modulus
BigInteger

Especifica el número por el que dividir value elevado a la potencia exponent.

Devoluciones

Resto después de dividir valueexponent por modulus.

Excepciones

modulus es cero.

exponent es negativo.

Ejemplos

En el ejemplo siguiente se proporciona una ilustración sencilla de llamar al ModPow método .

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

Comentarios

El ModPow método evalúa la siguiente expresión:

(baseValue ^ exponente) Módulo de módulo

Para realizar la exponenciación en BigInteger valores sin división de módulos, use el Pow método .

Se aplica a

Consulte también