in reply to Re^2: Find prime number between 1 to 1000000
in thread Find prime number between 1 to 1000000

For Project Euler problems I already needed an iterator that iterates over primes. (Under the hood it uses the sieve of Eratosthenes to calculate blocks of primes and then returns them.)

If you already have that iterator, dividing by the primes up to and including the square root is quite easy.

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