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

exponentべき乗value除算する数値。

返品

valueexponentmodulusで除算した後の剰余。

例外

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
open System.Numerics;

let number = 10I;
let exponent = 3;
let modulus = 30I;
printfn $"({number}^{exponent}) Mod {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 ^ exponent)Mod 剰余

剰余除算を使用せずに BigInteger 値の指数化を実行するには、 Pow メソッドを使用します。

適用対象

こちらもご覧ください