Scroll down to see how it works. If you'd rather solve the problem yourself, don't scroll. . . Phosphorus is much faster: http://phosphorus.github.io/#75201122 . . How it works (this is a spoiler): ========================================= We need to get all of the primes from 2 to 2 million. So we check every number from 2 to 2 million and see if it's prime. Except not the even numbers. Because those aren't prime (except two, which we add as an exception.) When we're checking if a number is prime, all we have to do is see if all the primes before it (up to its square root) are factors of the number. If none are, then it's prime. Lastly, we add everything together into the "grand total" variable. That wasn't so hard.
The @ProjectEuler account is created and maintained by @PullJosh. If you have questions, feel free to comment here or on my @PullJosh profile page for a much quicker response.