BigInteger.ModPow(BigInteger, BigInteger, BigInteger) メソッド

定義

ある数値を別の数値で累乗し、それをさらに別の数値で割った結果生じた剰余を求めます。

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

パラメーター

value
BigInteger

指数 exponent で累乗する数値。

exponent
BigInteger

value の指数。

modulus
BigInteger

value で累乗した exponent の除算に使用する除数。

戻り値

value 指数 modulus で割った結果生じた剰余。

例外

modulus が 0 です。

exponent が負の値です。

次の例では、 メソッドを呼び出す簡単な図を ModPow 示します。

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

注釈

メソッドは ModPow 、次の式を評価します。

(baseValue ^ 指数)Mod 剰余

剰余除算のない値に対して BigInteger 指数を実行するには、 メソッドを使用します Pow

適用対象

こちらもご覧ください