cont int MAX = 10005;
bool isPrime[MAX];
void sieve()
{
int lim=sqrt(MAX);
/* Initially Mark all numbers as Prime */
for(int i=2;i<MAX;i++)
isPrime[i]=1;
for(int i=2;i<=lim;i++)
if(isPrime[i]) /* for each Prime */
for(int j=2*i;j<MAX;j+=i) /* Cross out all multiples of i */
isPrime[j]=false;
}
On Mon, Mar 21, 2011 at 5:41 PM, rohit <[email protected]> wrote:
> i just want to know , when we make a program how update array after
> deleting alternate element.
>
> On Mar 21, 4:37 pm, Anurag atri <[email protected]> wrote:
> > what did you not understand in this ?
> >
> > On Mon, Mar 21, 2011 at 4:59 PM, rohit <[email protected]>
> wrote:
> > > genrate prime number using Sieve of Eratosthenes method
> > > explanation is herehttp://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
> > > pls help me out
> >
> > > --
> > > 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.
> >
> > --
> > Regards
> > Anurag Atri
>
> --
> 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.
>
>
--
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.