fork download
  1.  
  2. #include <string.h>
  3.  
  4. #define MAX 46656
  5. #define LMT 216
  6. #define LEN 4830
  7. #define RNG 100032
  8.  
  9. unsigned base[MAX/64], segment[RNG/64], primes[LEN];
  10.  
  11. #define sq(x) ((x)*(x))
  12. #define mset(x,v) memset(x,v,sizeof(x))
  13. #define chkC(x,n) (x[n>>6]&(1<<((n>>1)&31)))
  14. #define setC(x,n) (x[n>>6]|=(1<<((n>>1)&31)))
  15.  
  16. /* Generates all the necessary prime numbers and marks them in base[]*/
  17. void sieve()
  18. {
  19. unsigned i, j, k;
  20. for(i=3; i<LMT; i+=2)
  21. if(!chkC(base, i))
  22. for(j=i*i, k=i<<1; j<MAX; j+=k)
  23. setC(base, j);
  24. for(i=3, j=0; i<MAX; i+=2)
  25. if(!chkC(base, i))
  26. primes[j++] = i;
  27. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/crt1.o: In function `_start':
/home/aurel32/tmp/glibc/glibc-2.9/csu/../sysdeps/i386/elf/start.S:115: undefined reference to `main'
collect2: ld returned 1 exit status
stdout
Standard output is empty