Euclid's Algorithm in Python?
jepler at unpythonic.net
jepler at unpythonic.net
Thu Aug 4 22:50:56 EDT 2005
Well, this article
http://pythonjournal.cognizor.com/pyj1/AMKuchling_algorithms-V1.html
was the first hit on google for '"euclid's algorithm" python'.
It contains this function:
def GCD(a,b):
assert a >= b # a must be the larger number
while (b != 0):
remainder = a % b
a, b = b, remainder
return a
Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20050804/f2e7dcf1/attachment.sig>
More information about the Python-list
mailing list