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.
Java was used to create a working solution that ran in under 2 seconds for the worst case scenarion (20 testcases with N having a maximum value of 100 million in all of these cases and each test result was computed independently -- so no time savings because the testcase was the same in all of these instances)
The challenging part of this solution was efficently computing the primes up to 50 million (maximum N divided by smallest prime) and saving them in an array. This is done once. This array is then referenced in all of the test cases to produce the results desired.
Project Euler #187: Semiprimes
You are viewing a single comment's thread. Return to all comments →
Java was used to create a working solution that ran in under 2 seconds for the worst case scenarion (20 testcases with N having a maximum value of 100 million in all of these cases and each test result was computed independently -- so no time savings because the testcase was the same in all of these instances)
The challenging part of this solution was efficently computing the primes up to 50 million (maximum N divided by smallest prime) and saving them in an array. This is done once. This array is then referenced in all of the test cases to produce the results desired.