FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

UPDATED THE GCD FUNCTION AND MADE IT MORE EFFICIENT by DEVIL-NEEL · Pull Request #146 · AllAlgorithms/python · GitHub

This repository was archived by the owner on Sep 7, 2025. It is now read-only.
/ python Public archive
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
15 changes: 6 additions & 9 deletions algorithms/math/gcd.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
def gcd(A, B):
if B>A:
A, B = B, A
while B!=0:
temp = B
B = A%B
A = temp
return A
#EUCLIDEAN ALGORITHM FOR GCD CALCULATION
def computeGCD(x,y):
while(y):
x,y= y, x % y
return abs(x)

print(gcd(10,20))
print(computeGCD(10,20))

Back | FazBrowse Home | New Git URL