Please provide us with a concise, efficient and robust prime number generator written in Java/Scala/Go that gives all prime numbers in the range between two numbers provided by the user (e.g. user gives 1 and 10 and you return "2, 3, 5, 7").
- Make sure
jdk 8+
andmaven
are installed. - Clone this repo.
- Run
mvn test
to run the tests. - Run
mvn package -DskipTests
to generate a fat jar. - Run the generated jar
java -jar PATH_TO_JAR args
where args explained below.
Compiled fat jar is also available in the releases section.
-a, --algorithm=<algorithm> Algorithm to use for generation
Available Algorithms
1. TrialDivision
2. MillerRabin
3. Sieve
4. LinearSieve
-e, --end=<end> Upper bound of the range
-s, --start=<start> Lower bound of the range