diff --git a/src/math/computation.py b/src/math/computation.py index 7f09784..eefab41 100644 --- a/src/math/computation.py +++ b/src/math/computation.py @@ -1,5 +1,6 @@ def gcd_recursive(a: int, b: int) -> int: """Calculate greatest common divisor using Euclidean algorithm with recursion.""" - if b == 0: - return a - return gcd_recursive(b, a % b) + # Use an iterative approach to eliminate recursive call overhead + while b: + a, b = b, a % b + return a