The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
Finally, I use the Sieve of Erathosene method. I sugguest everyone look this up But, essentially, sieve method is as follows:
It's actaully sufficient to start from p^2 with every new prime we encounter, but that's not too important. Well, it will be for future cases. My code does not run optimally even though I understood the method and incorporated. I made some adjustment in later problems...
Anyhow, Wikipedia has a good demonstration of how the sieve method works:
From: Wikipedia
Answer: 142913828922
Runtime: 15.9 seconds