A simple React web app that computes the prime factorization of any positive integer and displays it in a clean, styled format. It also lists all prime numbers up to 2000 for quick reference. The project supports dark mode, is fully tested with Vitest, and can be easily deployed to GitHub Pages.
- Prime Factorization: Enter any positive integer and see its prime factors in exponent form (e.g.,
24 => 2³ * 3). - Prime Number List: Displays all prime numbers up to 2000 for reference.
- Dark Mode: Toggle between light and dark modes for better readability.
- Clean Result Display: Factorization results are highlighted in a styled result box.
- Simple and Intuitive UI: Just enter a number and click "Factorize".
- Deploy Easily:
npm run buildandnpm run deploy.
The live demo is deployed here:
- GitHub Pages: Prime Factorization Tool
- Alternative Tool: Integer Factorization to Prime Factors with API
To run the app locally:
- Clone the repository:
git clone https://github.com/doctorlai/prime-factorization.git
cd prime-factorization- Install dependencies:
npm install- Start the development server:
npm run dev- Run tests:
## or simply: npm test
npm run test- Test coverage:
npm run coverage-
Format code:
Run:npm run formatto check code formatting and; Run:npm run format:fixto fix formatting automatically. -
Open http://localhost:5173/prime-factorization/ in your browser.
- Enter a positive integer in the input box.
- The prime factorization will be displayed in a styled result box.
- Scroll down to see all prime numbers up to 2000.
- Toggle Light/Dark Mode with the 🌞/🌙 button.
Contributions are welcome!
- Fork the repository.
- Create a feature branch:
git checkout -b feature-branch- Commit your changes:
git commit -am 'Add new feature'- Push to your fork:
git push origin feature-branch- Open a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
See the AI generated wiki for more background.