Function pow
Computes x to the power y modulo z.
H pow(I, G, H)
(
auto in ref I x,
auto in ref G y,
auto in ref H z
)
if (isIntegral!I && isIntegral!G && isIntegral!H);
Parameters
Name | Description |
---|---|
I | Base type. |
G | Exponent type. |
H | Divisor type: |
x | Base. |
y | Exponent. |
z | Divisor. |
Returns
Reminder of the division of x to the power y by z.
Precondition
z > 0
Example
assert(pow(3, 5, 7) == 5);
assert(pow(2, 2, 1) == 0);
assert(pow(3, 3, 3) == 0);
assert(pow(7, 4, 2) == 1);
assert(pow(53, 0, 2) == 1);
assert(pow(53, 1, 3) == 2);
assert(pow(53, 2, 5) == 4);
assert(pow(0, 0, 5) == 1);
assert(pow(0, 5, 5) == 0);