Calculate primes in C