Skip to content

A restful web service that generates prime numbers up to n.

Notifications You must be signed in to change notification settings

saflin/prime-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

prime-generator

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.

  1. Trial by division

  2. Eratosthenes Sieve

  3. Parallel version of Eratosthenes Sieve

Building the project

Requires Java 1.8 and maven to build this project

  1. Clone the project to your local directory

  2. Go inside the local directory and execute below command

     mvn clean package
    

Implementation

This project runs on Spring Boot and uses below frame works

  1. Spring Boot
  2. Spring Test
  3. JUnit
  4. Mockitto
  5. Hamcrest
  6. SLF-4J

Running the application

After building the project execute the below command

    java -jar  target/prime-generator-1.0-SNAPSHOT.jar

This should start the spring boot application.

Testing the application

Project presently expose below rest endpoints and generates prime numbers up to Integer.MAX_VALUE (2147483647)

  1. Get all the supported prime generation algorithms

     http://localhost:8080/generator/algorithms 
    
  2. Get all prime number upto 'n' using TRIAL_DIVISION algorithm

     http://localhost:8080/generator/prime?algorithm=TRIAL_DIVISION&ceiling=n
    
  3. Get all prime number upto 'n' using ERATOSTHENES_SIEVE_SEQUENTIAL algorithm

     http://localhost:8080/generator/prime?algorithm=ERATOSTHENES_SIEVE_SEQUENTIAL&ceiling=n 
    
  4. Get all prime number upto 'n' using ERATOSTHENES_SIEVE_PARALLEL algorithm

     http://localhost:8080/generator/prime?algorithm=ERATOSTHENES_SIEVE_PARALLEL&ceiling=n 
    

About

A restful web service that generates prime numbers up to n.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages