Euler problem 3 in C using sieve of Eratosthenes