Problem 010

The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.

Find the sum of all the primes below two million.

Function Prob010() As Long
For k As Integer = 2 To 2000000
If IsPrime(k) Then Prob010 += k
End Function

They are making this WAY too easy. I’m not sure if it’s just the nature of this sort of problem or whether my IsPrime routine needs some tweaking, but this problem takes the longest compared to all of the others I’ve done up to this point. Even so, it’s only 10-seconds, which is well within the target range allowed by Project Euler.

Share Your Thought