You are viewing a single comment's thread. Return to all comments →
After a day of googling, I had realized this:
If you use common codes to find prime factors like here: https://www.geeksforgeeks.org/print-all-prime-factors-of-a-given-number/ , you cannot pass all test cases coz its time complexity = O(n^0.5) (I though it was the fastest algorithm ever but I was wrong)
If you use a more efficient algorithm like here: https://www.geeksforgeeks.org/efficient-program-print-number-factors-n-numbers/?ref=rp , you can pass coz it's only O(logn)
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #47: Distinct primes factors
You are viewing a single comment's thread. Return to all comments →
After a day of googling, I had realized this:
If you use common codes to find prime factors like here: https://www.geeksforgeeks.org/print-all-prime-factors-of-a-given-number/ , you cannot pass all test cases coz its time complexity = O(n^0.5) (I though it was the fastest algorithm ever but I was wrong)
If you use a more efficient algorithm like here: https://www.geeksforgeeks.org/efficient-program-print-number-factors-n-numbers/?ref=rp , you can pass coz it's only O(logn)