solution to problem 10 using the sieve of eratosthenes.