creating a sieve eratosthenes to solve the problem