diff --git a/src/math/computation.py b/src/math/computation.py index 7f09784..49f4833 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: + a, b = b, a % b + return a