thewebsitedev / prime-numbers-matrix

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PRIME NUMBERS MATRIX

This is a simple program that prints a multiplication table of the first N prime numbers.

Requirements

  • PHP 8.3
  • Composer 2.0
  • PHPUnit 10
  • Node 16.13
  • NPM 8.1
  • Jest 29.7
  • Puppeteer 21.6
  • TailwindCSS 3.3

Installation

  1. Clone the repository/
  2. Run composer install.
  3. Run composer dump-autoload.
  4. Run npm install.

Usage

  1. Navigate to the project folder.
  2. Run php -S localhost:8888.
  3. Open http://localhost:8888 in your browser.
  4. Enter a number in the input field and click the button or press enter.
  5. The table will be displayed below the input field.

Testing

  1. Navigate to the project root and run vendor/bin/phpunit to run the PHP tests [Unit & Integration tests].
  2. Navigate to the project root and run npm run test to run the JS tests [End-to-end tests].

The current implementaton is a bit memory intensive and slow for large numbers. It can be further improved by using a more efficient algorithm like segmented sieve of Eratosthenes. And for very large calculations it can be further improved by computing in chunks.

About


Languages

Language:PHP 91.5%Language:JavaScript 8.1%Language:CSS 0.3%