Implement the Sieve of Eratosthenes algorithm without threads.