diff --git a/src/math/computation.py b/src/math/computation.py index 7f09784..8320c6b 100644 --- a/src/math/computation.py +++ b/src/math/computation.py @@ -1,5 +1,5 @@ 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) + while b != 0: + a, b = b, a % b + return a