Use 1000 iterations, use long vars, starte searching prime with 2.
void printf (const char *fmt, ...);
void abort (void);
#define SieveSize 819000
-#define N_ITER 10
+#define N_ITER 1000
int sieve (int n) {
- int i, k, prime, count, iter;
+ long i, k, count, iter, prime;
char flags[SieveSize];
for (iter = 0; iter < n; iter++) {
count = 0;
for (i = 0; i < SieveSize; i++) flags[i] = 1;
- for (i = 1; i < SieveSize; i++)
+ for (i = 2; i < SieveSize; i++)
if (flags[i]) {
prime = i + 1;
for (k = i + prime; k < SieveSize; k += prime) flags[k] = 0;
