Basic sieve of eratosthenes implementation for finding primes.