We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- All Contests
- ProjectEuler+
- Project Euler #248: Numbers for which Euler’s totient function equals 13!
- Discussions
Project Euler #248: Numbers for which Euler’s totient function equals 13!
Project Euler #248: Numbers for which Euler’s totient function equals 13!
Sort by
recency
|
6 Discussions
|
Please Login in order to post a comment
Just pass the first test, any example to test against it that I can use? how do I know where I'm failing
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
My program finds 13!'s divisors 66528 and 93600 (among others) because their successor is a prime and combines them. Sorting those roughly 180000 numbers finishes almost instantly but I went the crazy way and preferred ''std::nth_element'' because it is a little bit more efficient - but you can't measure the performance advantage
To check the cardinality ("checksum") of your sets ϕ-1(m), consider these resources I used:
In Python testcases, the limit for time is 20 seconds and memory is 512 megabytes. My Python3 code runs under 360 milliseconds; its own prime factorization uses memo-ization.
can anyone explain the question?