Added solution to 10 using a modified sieve of eratosthenes