Euler 10, Eratosthenes sieve and naive implementation