Removed duplicate p1a solution
Replaced naive getPrimes function with a sieve of eratosthenes