Skip to content

Instantly share code, notes, and snippets.

@gnp
Created May 14, 2011 06:58
Show Gist options
  • Save gnp/972003 to your computer and use it in GitHub Desktop.
Save gnp/972003 to your computer and use it in GitHub Desktop.
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
----------
In Mathematica:
In[1]:= s = 0; p = 2; While[p < 2000000, s += p; p = NextPrime[p]]; s
Out[1]= 142913828922
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment