Project Euler #243: Resilience

  • + 0 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))])

    print("x:",x)

    val=x/(i-1)

    print(val)

    print(b[0]/b[1])

    if(val < b[0]/b[1]):

      print(i)
    
      break
    

    i=i+1