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.
Sum of first 126000 primes is 10^11.
( http://wolframalpha.com/input/?i=sum+of+first+126000+primes )
For 10^12 sum you need about 380000 primes and sieve for 6*10^6. Anyway - such sieve (even simple implementation) should be pretty fast (make sure you start marking non-primes with i*i).
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 →
Sum of first 126000 primes is 10^11. ( http://wolframalpha.com/input/?i=sum+of+first+126000+primes ) For 10^12 sum you need about 380000 primes and sieve for 6*10^6. Anyway - such sieve (even simple implementation) should be pretty fast (make sure you start marking non-primes with i*i).