Skip to content

DoctorLai/prime-factorization

Repository files navigation

Prime Factorization App

Prime Factorization (Built, Lint and Test) Run Tests with Coverage

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.

Features

  • 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 build and npm run deploy.

Live Demo

The live demo is deployed here:

image

Installation

To run the app locally:

  1. Clone the repository:
git clone https://github.com/doctorlai/prime-factorization.git  
cd prime-factorization
  1. Install dependencies:
npm install
  1. Start the development server:
npm run dev
  1. Run tests:
## or simply: npm test
npm run test
  1. Test coverage:
npm run coverage
  1. Format code:
    Run: npm run format to check code formatting and; Run: npm run format:fix to fix formatting automatically.

  2. Open http://localhost:5173/prime-factorization/ in your browser.

Usage

  1. Enter a positive integer in the input box.
  2. The prime factorization will be displayed in a styled result box.
  3. Scroll down to see all prime numbers up to 2000.
  4. Toggle Light/Dark Mode with the 🌞/🌙 button.

Contributing

Contributions are welcome!

  1. Fork the repository.
  2. Create a feature branch:
git checkout -b feature-branch
  1. Commit your changes:
git commit -am 'Add new feature'
  1. Push to your fork:
git push origin feature-branch
  1. Open a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation

See the AI generated wiki for more background.

Acknowledgments

  • Built with ❤️ by @justyy
  • Initial boilerplate provided by ChatGPT.
  • If you found this tool useful, consider buying me a coffee ☕ Thank you!