You are viewing a single comment's thread. Return to all comments →
this is the possible answer ig:
def lcm(c,d):
return(c*d/gcd(c,d))
def gcd(c,d):
if(c==0): return d else: return(gcd(d%c,c))
a=int(input())
for i in range(a):
b=input().split() b=[int(b[i]) for i in range(2)]
i=3
z=[]
while True:
x=sum([1 for j in range(1,i) if(lcm(j,i)==(i*j))])
val=x/(i-1)
if(val < b[0]/b[1]):
print(i) break
i=i+1
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #243: Resilience
You are viewing a single comment's thread. Return to all comments →
this is the possible answer ig:
def lcm(c,d):
def gcd(c,d):
a=int(input())
for i in range(a):
i=3
z=[]
while True:
x=sum([1 for j in range(1,i) if(lcm(j,i)==(i*j))])
print("x:",x)
val=x/(i-1)
print(val)
print(b[0]/b[1])
if(val < b[0]/b[1]):
i=i+1