Skip to content

Commit d6fec67

Browse files
committed
Merge branch 'branch1' of https://github.com/Acuspeedster/Python into branch1
2 parents 50fd058 + fd37108 commit d6fec67

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

maths/gcd_of_n_numbers.py

+2
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def get_greatest_common_divisor(*numbers: int) -> int:
105105
mult *= m
106106
return mult
107107

108+
108109
def gcd_tail_recursive(a: int, b: int) -> int:
109110
"""
110111
Calculate the Greatest Common Divisor (GCD) using a tail-recursive approach.
@@ -157,6 +158,7 @@ def gcd_tail_recursive(a: int, b: int) -> int:
157158
return abs(a)
158159
return gcd_tail_recursive(b, a % b)
159160

161+
160162
if __name__ == "__main__":
161163
print(get_greatest_common_divisor(18, 45)) # 9
162164
print(gcd_tail_recursive(23, 37)) # 1

0 commit comments

Comments
 (0)