BigInteger.ModPow(BigInteger, BigInteger, BigInteger) Metoda

Definice

Provede dělení modulus u čísla zvýšeného na mocninu jiného čísla.

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

Parametry

value
BigInteger

Číslo, které se má zvýšit na mocninu exponent .

exponent
BigInteger

Exponent, o který se má zvýšit value .

modulus
BigInteger

Číslo, kterým se má dělit value na mocninu exponent .

Návraty

Zbytek po vydělení valueexponentu pomocí modulus.

Výjimky

modulus je nula.

exponent je negativní.

Příklady

Následující příklad poskytuje jednoduchý obrázek volání ModPow metody.

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

Poznámky

Metoda ModPow vyhodnotí následující výraz:

(baseValue ^ exponent) Modul modu

Pokud chcete provést exponenci u BigInteger hodnot bez dělení modulu, použijte metodu Pow .

Platí pro

Viz také