diff --git a/maths/modular_exponential.py b/maths/modular_exponential.py index eadde7e793d8..b081b83d58ab 100644 --- a/maths/modular_exponential.py +++ b/maths/modular_exponential.py @@ -21,7 +21,7 @@ def modular_exponential(base: int, power: int, mod: int): if power < 0: return -1 base %= mod - result = 1 + result = 1 % mod while power > 0: if power & 1: