A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself.
This generator uses multiple methods to highlight pros/cons of different approaches.
Method / Primes count | 10,000 | 100,000 | 1,000,000 |
Direct | 70 | 423 | 10920 |
Set Sieve* | 1 | 10 | 238 |
Dictionary | 9642 | - | - |
Direct Cached | 84 | 362 | 8219 |
* Set Sieve method takes around 4s to initialise and afterwards it is just using precalculated sieve.