# include # include # include typedef unsigned long int term; static term start = 2, max = 200000000; int main (int argc, char **argv) { char *m = calloc(max, sizeof(char)); term i, n; term done = sqrt(max); for (i = start; i < max; i++) m[i] = 1; for (n = start; n <= done; n++) { if (!m[n]) continue; for (i = n * 2; i <= max; i += n) m[i] = 0; } #ifndef NOPRINT for (i = start; i < max; i++) if (m[i]) printf("%ld\n", i); #endif }