Project Euler #47: Distinct primes factors

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