Why is my algorithm for finding the sum of all prime numbers below 2 million so slow?
I\'m a fairly beginner programmer and this is what I came up with for finding the solution:
You need to use prime sieve check out eratostheneses sieve and try to implement it in code.
Trial division is very inefficient for finding primes because it has complexity n square, the running time grows very fast. This task is meant to teach you how to find something better.