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.
As @tieros suggests sieve is fine for 10^6 input, but for higher n, we can directly find the factors of the given ans (as the ans can be found in O(1) time). Time complexity would be dependent on the time taken to find factors O(sqrt(N)) as per Factors time complexity
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #69: Totient maximum
You are viewing a single comment's thread. Return to all comments →
As @tieros suggests sieve is fine for 10^6 input, but for higher n, we can directly find the factors of the given ans (as the ans can be found in O(1) time). Time complexity would be dependent on the time taken to find factors O(sqrt(N)) as per Factors time complexity