From 979ca3f0d7986f4405c75ad50967a4f324aba687 Mon Sep 17 00:00:00 2001 From: saquib000 Date: Mon, 12 Feb 2024 15:07:09 +0530 Subject: [PATCH 1/2] added euclids_algorithim.py which finds the gcd using euclidean algorithim --- euclids_algorithim.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 euclids_algorithim.py diff --git a/euclids_algorithim.py b/euclids_algorithim.py new file mode 100644 index 0000000..b17ef72 --- /dev/null +++ b/euclids_algorithim.py @@ -0,0 +1,16 @@ +# Recursive implementation of Euclidean algorithm +def gcd(m, n): + """ + Calculates the greatest common divisor (GCD) of two positive integers using the Euclidean algorithm. + + Args: + m (int): First positive integer. + n (int): Second positive integer. + + Returns: + int: The GCD of m and n. + """ + (a, b) = (max(m, n), min(m, n)) + while b != 0: + a, b = b, a % b + return a \ No newline at end of file From 3132253e7b98f218a4574dc1aa6269f7caf1737d Mon Sep 17 00:00:00 2001 From: saquib000 Date: Mon, 12 Feb 2024 15:14:13 +0530 Subject: [PATCH 2/2] updated euclids_algorithm.py --- euclids_algorithim.py => euclids_algorithm.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename euclids_algorithim.py => euclids_algorithm.py (100%) diff --git a/euclids_algorithim.py b/euclids_algorithm.py similarity index 100% rename from euclids_algorithim.py rename to euclids_algorithm.py