| File | Date | Author | Commit |
|---|---|---|---|
| img | 2026-02-02 |
|
[954310] Add logo |
| src | 2026-02-01 |
|
[569c56] Correct warnings |
| LICENSE.txt | 2026-02-02 |
|
[1b8c1c] Add README.md and LICENSE.txt |
| README.md | 2026-02-02 |
|
[1b8c1c] Add README.md and LICENSE.txt |
| pom.xml | 2026-02-01 |
|
[9a4369] Add maven and main class to be able to use it a... |
This project was initiated as a Java library for certain number calculations. The first class was committed in November 2015, along with tests, but then never touched again, and left even without a README.
February 2026, a command line interface (CLI) was added and the project was restructured to be built with Maven. Perhaps, this will still be extended in teh future, but at least it's in a useful state now, although single-purpose.
If the project is built, it will currently generate a .jar file, that can be executed by a Java Runtime Environment, to calculate the prime factors for any given integer number.
Building is very straight-forward like a regular maven project. You need Maven installed, or use the version shipped with your IDE. Intellij, for example, should recognize the project as a Maven project and show you the Maven menu on the right. Under Numbers Java, from the Lifecycle menuJust double-click mvn install, for example and a .jar file will be created in the project's target directory.
On a regular Linux machine, or probabbly any computer with a properly functioning command line, just enter the project main folder (in which the pom.xml and this README.md is located) and type:
mvn install or
mvn clean install if you want to get rid of any previous builds in the target folder first.
You can copy the .jar file to any location you'd like and execute it from there with java -jar, along with the integer number of which you'd like to know the prime factors, so for example:
java -jar [name_of_jar_file].jar 273`
If everything went well, your terminal will answer you the following, a list of prime factors of the number 273, from low to high:
[3, 7, 13]
What I've done myself (on Ubuntu Linux), is to copy the .jar file to a new location and rename it, and then add an alias to my .bashrc file, so I can use it from everywhere in my terminal.
sudo mkdir /usr/local/lib/java &&
sudo cp [name_of_jar_file].jar /usr/local/lib/java/prime-factors.jar
The open the .bashrc file or any external aliases file (usually .bash_aliases which is automatically recognized and included by the .bashrc file) and add the following line:
alias prime-factors='java -jar /usr/local/lib/java/prime-factors.jar'
To enable your new command, your .bashrc needs to be reloaded first, by typing:
source ~/.bashrc
The Java code currently has 100% code coverage by unit tests (JUnit). See ./src/test/java/.
Enjoy! I hope you'll find this code or tool useful. If you'd like to support my work, you can always:
