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.
this might not use a list of primes, but it is also much slower. calculating max primes runs in O(n*log(n)) (n for looking at all the numbers and log(n) for the gcd).
using a list of primes is O(1) and you can make the list manually in a minute.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Leonardo's Prime Factors
You are viewing a single comment's thread. Return to all comments →
this might not use a list of primes, but it is also much slower. calculating max primes runs in O(n*log(n)) (n for looking at all the numbers and log(n) for the gcd). using a list of primes is O(1) and you can make the list manually in a minute.