Gabriel Genellina wrote:
En Fri, 27 Nov 2009 12:36:29 -0300, n00m <n...@narod.ru> escribió:

Maybe someone'll make use of it:


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

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

Reply via email to