Ejemplo n.º 1
0
def three_to_two(m):
    cnt = 0
    for d in range(3, m+1):
        down = d/3 + 1
        if d % 2 == 0:
            up = d/2
        else:
            up = d/2 + 1
        for n in range(down,up):
            if mtools.gcd(n, d) == 1:
                cnt = cnt + 1
    return cnt
Ejemplo n.º 2
0
def normalize(e, d):
    g = mtools.gcd(e, d)
    return e/g, d/g