in reply to Find prime number between 1 to 1000000
I agree with the other monks who have suggested the Sieve of Eratosthenes. It is The Way to find all prime numbers between 1 and some upper limit.
For another discussion of prime finding, see ulam's spiral too slow
In Section
Seekers of Perl Wisdom