Esempio n. 1
0
def e276(top=10**7):
    count = 0
    for i in range(1, top):
        print(i)
        for j in range(1, top):
            if i + j > top: break
            for k in range(j - i + 1, j + i + 1):
                if i + j + k > top: break
                x = gcd(gcd(i, j), gcd(i, k))
                if x % 1 == 0: count += 1
    return count
Esempio n. 2
0
def e276(top = 10**7):
    count = 0
    for i in range(1,top):
        print(i)
        for j in range(1,top):
            if i+j>top:break
            for k in range(j-i+1,j+i+1):
                if i+j+k>top:break
                x = gcd(gcd(i,j),gcd(i,k))
                if x%1==0:count +=1
    return count
Esempio n. 3
0
def e127(top):
    ret = 0
    l = 0
    for a, b in combo(range(1, top), 2):
        if not a & 1 and not b & 1: continue
        c = a + b
        if not a & 1 and not c & 1: continue
        if not c & 1 and not b & 1: continue
        if a != l:
            print(a, b, end='\r')
            l = a
        if a > b: continue
        if gcd(a, b) != 1 or gcd(b, c) != 1 or gcd(c, a) != 1:
            continue
        if rad(a, b, c) < c:
            ret += c
    print()
    return ret
Esempio n. 4
0
def e127(top):
    ret = 0
    l = 0
    for a,b in combo(range(1,top),2):
        if not a&1 and not b&1:continue
        c = a+b
        if not a&1 and not c&1:continue
        if not c&1 and not b&1:continue
        if a!=l:
            print(a,b,end='\r')
            l=a
        if a>b:continue
        if gcd(a,b)!=1 or gcd(b,c)!=1 or gcd(c,a)!=1:
            continue
        if rad(a,b,c)<c:
            ret+=c
    print()
    return ret
Esempio n. 5
0
def e75(top=1500000):
    count = 0
    alist = [0]*top
    tops = int(sqrt(top))
    for i in range(1,int(tops),2):
        for j in range(2,int(tops)-i,2):
            if i+j>top:break
            if gcd(i,j)==1:
                x = abs(j*j-i*i)
                y = 2*i*j
                z = j*j+i*i
                s = x+y+z
                for p in range(s,top,s):alist[p]+=1
    return alist.count(1)
    '''
Esempio n. 6
0
def e75(top=1500000):
    count = 0
    alist = [0] * top
    tops = int(sqrt(top))
    for i in range(1, int(tops), 2):
        for j in range(2, int(tops) - i, 2):
            if i + j > top: break
            if gcd(i, j) == 1:
                x = abs(j * j - i * i)
                y = 2 * i * j
                z = j * j + i * i
                s = x + y + z
                for p in range(s, top, s):
                    alist[p] += 1
    return alist.count(1)
    '''
Esempio n. 7
0
def f(g, l, n):
    count = 0
    for combo in combos(range(1, l + 1), n):
        if g <= gcd(combo) and l >= lcm(combo):
            count += 1
    return count
Esempio n. 8
0
def f(g,l,n):
    count = 0
    for combo in combos(range(1,l+1),n):
        if g<=gcd(combo) and l>=lcm(combo):
            count +=1
    return count