From fc3dec605316568c33a00f583d53539c690b357a Mon Sep 17 00:00:00 2001 From: devam007 Date: Fri, 23 Oct 2026 20:57:24 +0530 Subject: [PATCH] fix: reduce modular exponentiation identity --- maths/modular_exponential.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: