Solution for Problem #10 (using The  sieve of Eratosthenes)