hav a look at dis one...prime no upto 100000
#define N 100000
bool mark [N];
memset (mark, true, sizeof (mark));
mark [0] = mark [1] = false;
for ( int i = 4; i < N; i += 2 ) mark [i] = false;
for ( int i = 3; i * i <= N; i += 2 ) {
if ( mark [i] ) {
for ( int j = i * i; j < N; j += 2 * i ) mark [j] = false;
}
}
mark[i]=true ,, i represents prime no.
--
Sanchit Mittal
Second Year Undergraduate
Computer Engineering
Delhi College of Engineering
ph- +919582414494
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.