Category : Miscellaneous Language Source Code
Archive   : SCOPE1.ZIP
Filename : SIEVE.C

 
Output of file : SIEVE.C contained in archive : SCOPE1.ZIP
#include

#define TRUE 1
#define FALSE 0
#define SIZE 8190
#define ITER 25

char flags[SIZE+1];

main(argc, argv)
int argc;
char *argv[];
{
int i, k;
int prime, count, iter;
long begin, end, clock();

begin = clock();
for(iter = 1; iter <= ITER; iter++) {
count = 0;
memset(flags, '\0', SIZE+1);
for(i = 0; i <= SIZE; i++) {
if(flags[i]) {
prime = i+i+3;
k = i+prime;
while(k <= SIZE) {
flags[k] = FALSE;
k += prime;
}
count += 1;
}
}
}
end = clock();
printf("%d iterations = %5.2f seconds\n", ITER, (float) (end-begin)/100.);
}


  3 Responses to “Category : Miscellaneous Language Source Code
Archive   : SCOPE1.ZIP
Filename : SIEVE.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/