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.
Maintain a boolean array for very fast primality check sieving for n <= 10^k, then use a fast primality test (e.g.: Miller-Rabin) for n > 10^k. My code passes all tests sieving for either 10^6, 10^7 and 10^8.
If you are already doing that, you need to optimize somewhere else :)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #118: Pandigital prime sets
You are viewing a single comment's thread. Return to all comments →
Maintain a boolean array for very fast primality check sieving for n <= 10^k, then use a fast primality test (e.g.: Miller-Rabin) for n > 10^k. My code passes all tests sieving for either 10^6, 10^7 and 10^8.
If you are already doing that, you need to optimize somewhere else :)