Project Euler #248: Numbers for which Euler’s totient function equals 13!

  • + 0 comments

    from math import factorial

    def gcd(p,q): while q != 0: p, q = q, p%q return p def is_coprime(x, y): return gcd(x, y) == 1

    c=list(map(int,input().rstrip().split())) d=[] n= factorial(c[0]) b= 1 for i in range(n-1,2,-1): if (is_coprime(n,i)==1): b+=1 break d.append(i)

    print(d[len(d)-1])

    this code is working for smaller values but with the inputs of the problem it is showing time out please help