I've created a simple tool which lets you calculate all prime numbers up to a given number. It uses four different algorithms and generates a report to compare the performance of each algorithm.
-
Algorithm 1: Check all possible divisors from 2 to n-1 for each number
-
Algorithm 2: Check all possible divisors from 2 to sqrt(n) for each number
-
Algorithm 3: Check all possible divisors from 2 to sqrt(n) for each number, but skip all even numbers
-
Sieve of Eratosthenes
Currently, algorithm 1 will be skipped for numbers greater than 100000, because it will take over a minute to calculate. In the future, I might add the possibility to customize the maximum runtime that the algorithm is allowed to take.
If you have any ideas, feel free to contribute via issue or pull requests.