En Tue, 08 Dec 2009 15:51:29 -0300, MRAB <pyt...@mrabarnett.plus.com> escribió:
Gabriel Genellina wrote:
En Fri, 27 Nov 2009 12:36:29 -0300, n00m <n...@narod.ru> escribió:

def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)

def brent(n): ...
A better place to publish this code would be the Python Cookbook: http://code.activestate.com

An iterative alternative is:

def gcd(x, y):
     while y != 0:
         x, y = y, x % y
     return x

(note that the interesting part was the snipped code, the brent() function...)

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to