BigInteger.ModPow(BigInteger, BigInteger, BigInteger) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Effectue une division avec coefficient sur un nombre élevé à la puissance d'un autre nombre.
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
Paramètres
- value
- BigInteger
Nombre à élever à la puissance exponent
.
- exponent
- BigInteger
Exposant de value
.
- modulus
- BigInteger
Nombre par lequel diviser value
élevé à la puissance exponent
.
Retours
Reste de la division de value
exposant par modulus
.
Exceptions
modulus
est égal à zéro.
exponent
est un nombre négatif.
Exemples
L’exemple suivant fournit une illustration simple de l’appel de la ModPow méthode .
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
Remarques
La ModPow méthode évalue l’expression suivante :
(exposant baseValue ^ ) Modulus
Pour effectuer une exponentiation sur BigInteger des valeurs sans division de module, utilisez la Pow méthode .
S’applique à
Voir aussi
Commentaires
https://aka.ms/ContentUserFeedback.
Prochainement : Tout au long de l'année 2024, nous supprimerons progressivement les GitHub Issues en tant que mécanisme de retour d'information pour le contenu et nous les remplacerons par un nouveau système de retour d'information. Pour plus d’informations, voir:Soumettre et afficher des commentaires pour