fork download
  1. #include <stdio.h>
  2.  
  3. #define MAX_N 1000000
  4.  
  5. #define IS_PRIME 0
  6. #define NOT_PRIME 1
  7.  
  8. int main(void)
  9. {
  10. int primeTable[MAX_N] = {1, 1};
  11. int i, j;
  12. for (i = 2; i < MAX_N; ++i)
  13. if (primeTable[i] == IS_PRIME)
  14. for (j = i; j < MAX_N; j += i)
  15. primeTable[j] = NOT_PRIME;
  16.  
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0.03s 5612KB
stdin
Standard input is empty
stdout
Standard output is empty