problem 10 optimization using sieve of eratosthenes