Sieve of Eratosthenes implementation in C++