Okay I got it myself @OP This can be done in O(n*k*logn) where k is of order 10^3 at the very max , when u need a prime like 1 trillion
On Jan 28, 6:44 pm, sankalp srivastava <[email protected]> wrote: > Correct me if I'm wrong , but according to you , will this be the > approach ? > > boolean array[100000]; > int primes[1000000]; > void seive() > { > int index=0; > for(int i=2;i*i<100000;i++) > { > if(isprime[i]) > { > primes[index++]=i; > for(int j=i*2;j<1000000;j+=i) > { > isprimes[i]= false; > } > > } > } > int kindex=index; > > } > > /* > But now , how should I find out the 1 millionth prime number ? > It requires another seive , i know , but it requires still bigger > range */ > Can you give me a pseudocode ? > */ > > On Jan 26, 8:20 pm, juver++ <[email protected]> wrote: > > > > > @above One million is 10^6. > > Problem wants 1 million of prime numbers. Not the prime numbers in range > > 1..10000000. > > So, you should use two sieves. -- 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.
