Example #1
0
def proj():
    pnum = 105
    answer = 0

    mx = 1001
    sieve = my_euler.fast_sieve(mx)
    cnt = 0
    for a in range(1, mx - 1):
        for b in range(a + 1, mx):
            c = a + b
            if 1 != my_euler.gcd(a, b) or 1 != my_euler.gcd(a, c) or 1 != my_euler.gcd(b, c):
                continue
            cnt += abc_hit(a, b, sieve)

    answer = cnt
    print("")
    print_project_answer(pnum, answer)
Example #2
0
def proj():
    pnum = 105
    answer = 0

    mx = 1001
    sieve = my_euler.fast_sieve(mx)
    cnt = 0
    for a in range(1, mx - 1):
        for b in range(a + 1, mx):
            c = a + b
            if 1!=my_euler.gcd(a,b) or \
               1!=my_euler.gcd(a,c) or \
               1!=my_euler.gcd(b,c):
                continue
            cnt += abc_hit(a, b, sieve)

    answer = cnt
    print("")
    print_project_answer(pnum, answer)
Example #3
0
def frac_num ( den ):
    ans = 0
    num = den//2
    if num/float(den)==1.0/2.0:
        num = num-1
    for x in range(num,0,-1):
        if float(x)/den<=1/float(3):
            break
        if 1==my_euler.gcd(x,den):
            #print(" %d/%d " % (x,den))
            ans = ans+1
        num = num-1
    return ans
Example #4
0
def frac_num(den):
    ans = 0
    num = den // 2
    if num / float(den) == 1.0 / 2.0:
        num = num - 1
    for x in range(num, 0, -1):
        if float(x) / den <= 1 / float(3):
            break
        if 1 == my_euler.gcd(x, den):
            #print(" %d/%d " % (x,den))
            ans = ans + 1
        num = num - 1
    return ans