in reply to Find prime number between 1 to 1000000

mecrazycoder,
Yes, determining if a number is prime can be done in polynomial time. If you want to know all the prime numbers up to a certain value, the best way is probably the sieve of Eratosthenes (or a variation). There are also websites that list all prime numbers up to certain values that you could just create a lookup table for such a small number (1 million isn't very big). Given how limited your post is, it is hard to tell what you really want. Math::Pari has functions for determining primeness.

Cheers - L~R

  • Comment on Re: Find prime number between 1 to 1000000

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.