Calculate the sum of all primes less than 2,000,000 in Swift
This is a bit of a brute-force solution using trial division, with an optimization that you try dividing by just the previously discovered primes.

When you want to find many primes, though, a much faster algorithm is the sieve-of-eratosthenes.