ModPowL function
Warning
This documentation refers to the Classic QDK, which has been replaced by the Modern QDK.
Please see https://aka.ms/qdk.api for the API documentation for the Modern QDK.
Namespace: Microsoft.Quantum.Math
Package: Microsoft.Quantum.QSharp.Foundation
Performs modular division on a number raised to the power of another number.
function ModPowL (value : BigInt, exponent : BigInt, modulus : BigInt) : BigInt
Input
value : BigInt
The value to be raised to the given exponent.
exponent : BigInt
The exponent to which value
is to be raised.
modulus : BigInt
The modulus with respect to which value ^ exponent
is to be computed.
Output : BigInt
The result of (value ^ exponent) % modulus
.
Example
The following snippet computs $11^31415 \bmod 13$:
let result = ModPowL(11, 31415, 13); // 6
Remarks
The implementation of this function takes the modulus at each step,
making it much more efficient than (value ^ exponent) % modulus
for
large values of value
and exponent
.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for