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.
Found the issue. I was sieving up to 2x10^7. For N > 2x10^7 which were themselves the solution (eg. 20027257), the algorithm was returning the longest series < N (when it should be <=N). It was only happening at N larger than my sieve limit, though, so my other tests didn't catch it.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #50: Consecutive prime sum
You are viewing a single comment's thread. Return to all comments →
Found the issue. I was sieving up to 2x10^7. For N > 2x10^7 which were themselves the solution (eg. 20027257), the algorithm was returning the longest series < N (when it should be <=N). It was only happening at N larger than my sieve limit, though, so my other tests didn't catch it.