I think one can use an elimination method . List out all the numbers
. Keep on eliminating the multiples of 2{excluding 2} , then multiples
of 3 , then multiples of 5 , then 7 , the denseness of the numbers
eliminated will get less .  And obviouslly you will get the numbers .

On 1/25/11, siddharth srivastava <akssps...@gmail.com> wrote:
> Hey Dave
>
> On 25 January 2011 18:17, Dave <dave_and_da...@juno.com> wrote:
>
>> The most efficient approach is to google "millionth prime number" and
>> select the first hit.
>>
>> Good one. But it was asked to me in an interview.
> The trivial approach would be to check for every number to be a prime an
> continue till
> the count of prime no reaches 1 million.
>
> Another approach according to me would be to use gcd approach for the same
> but it doesn't guarantees the order of primes I guess (correct me if I am
> wrong)
>
> The interviewer still wanted a better approach. I know of better approaches
> if a range is given, but what to do in this case.
>
>
>> Dave
>>
>> On Jan 25, 6:00 am, siddharth srivastava <akssps...@gmail.com> wrote:
>> > Hi
>> >
>> > Its an easy one but still I am looking for the most efficient approach.
>> >
>> > Find first 1 million prime numbers.
>> >
>> > --
>> > Siddharth Srivastava
>> >
>> > When you have learned to snatch the error code from the trap frame, it
>> will
>> > be time for you to leave.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> Siddharth Srivastava
>
> When you have learned to snatch the error code from the trap frame, it will
> be time for you to leave.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Rahul K Rai
rahulpossi...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to