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 reply to Re: Find prime number between 1 to 1000000
by kyle
in thread Find prime number between 1 to 1000000
by mecrazycoder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |