Problem 3 and Sieve of Eratosthenes