Project Euler #243: Resilience

Sort by

recency

|

13 Discussions

|

  • + 0 comments

    when p = 1/10, the answer is near 1.6516447 * 10^103 I hope this infomation will help you

  • + 0 comments

    phew!! at last after 4 months my code worked!! learned a lot with this challenge

  • + 0 comments

    is there a way to see the test cases? dont understand why I cant pass more than two

  • + 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

  • + 1 comment

    Accordinng to the problem description if we calculate the resilience of d = 9, we see that R(9) = 2/8 < 4/10. If so then, d = 9 should be the smallest denominator for which R(d) < 4/10 But in the example given in problem description d = 12 is considered as smallest denominator having a resilience R(d) < 4/10. Am I interpreting the problem wrongly ?