From ff830c6fb87d4ca6064ae8a2d6847888d8e0754b Mon Sep 17 00:00:00 2001 From: typosaurus Date: Sat, 25 Jul 2026 18:51:44 +0200 Subject: [PATCH] feat: add gcd at the end of the file --- src/calculator.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/calculator.py b/src/calculator.py index b6e95e6..e392fe0 100644 --- a/src/calculator.py +++ b/src/calculator.py @@ -12,3 +12,9 @@ def modulo(left: int, right: int) -> int: if right == 0: raise ValueError('modulo by zero') return left % right + + +def gcd(left: int, right: int) -> int: + while right: + left, right = right, left % right + return abs(left)