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.
I get everything but test case 9. Curriously, 9 sumtimes returns "Wrong answer" and other times returns "Runtime Error." Has anyone else run into this?
For some reason hackerrank is failing to post my comment with the code pasted.
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
Join us
Create a HackerRank account
Be part of a 26 million-strong community of developers
Please signup or login in order to view this challenge
Project Euler #50: Consecutive prime sum
You are viewing a single comment's thread. Return to all comments →
python3
I get everything but test case 9. Curriously, 9 sumtimes returns "Wrong answer" and other times returns "Runtime Error." Has anyone else run into this?
For some reason hackerrank is failing to post my comment with the code pasted.
my tests for 2, 3, 4, 5, 10, 100, 1000, 1000000, 1000000000, and 1000000000000 all return correct results as expected.
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.