A Spring boot application which generates prime numbers. Application exposes rest endpoint which can be used to generate prime numbers.
Supports three prime generation algorithms.
-
Trial by division
-
Eratosthenes Sieve
-
Parallel version of Eratosthenes Sieve
Requires Java 1.8 and maven to build this project
-
Clone the project to your local directory
-
Go inside the local directory and execute below command
mvn clean package
This project runs on Spring Boot and uses below frame works
- Spring Boot
- Spring Test
- JUnit
- Mockitto
- Hamcrest
- SLF-4J
After building the project execute the below command
java -jar target/prime-generator-1.0-SNAPSHOT.jar
This should start the spring boot application.
Project presently expose below rest endpoints and generates prime numbers up to Integer.MAX_VALUE (2147483647)
-
Get all the supported prime generation algorithms
http://localhost:8080/generator/algorithms
-
Get all prime number upto 'n' using TRIAL_DIVISION algorithm
http://localhost:8080/generator/prime?algorithm=TRIAL_DIVISION&ceiling=n
-
Get all prime number upto 'n' using ERATOSTHENES_SIEVE_SEQUENTIAL algorithm
http://localhost:8080/generator/prime?algorithm=ERATOSTHENES_SIEVE_SEQUENTIAL&ceiling=n
-
Get all prime number upto 'n' using ERATOSTHENES_SIEVE_PARALLEL algorithm
http://localhost:8080/generator/prime?algorithm=ERATOSTHENES_SIEVE_PARALLEL&ceiling=n