Originally Posted by

**master5001**
Your algorithm also seems flawed. I don't know if you have actually looked at some real prime number algorithms but they are actually quite extensive.

[/edit]

More extensive than this?

Code:

#include <stdio.h>
#define UPPER 100000
int main(void)
{
int i, arr[UPPER];
unsigned long j;
for (i = 2; i < UPPER; i++) {
arr[i] = 1;
}
for (i = 2; i < UPPER; i++) {
if (arr[i]) {
for (j = i; i * j < UPPER; j++) {
arr[i * j] = 0;
}
}
}
for (i = 2; i < UPPER; i++) {
if (arr[i]) {
printf("%d \n", i);
}
}
return 0;
}

~/