JavaScript and Python solutions to the Project Euler problems.
These are shared modules that are referenced throughout many of the solutions. For example, the digits module is used for doing common operations on numeric values such as: listing the digits in any integer number, counting the number of digits in any integer number, etc.
Utility | JavaScript Module | Python Module |
---|---|---|
combination | JavaScript | Python |
coprime | JavaScript | Python |
digits | JavaScript | Python |
factors | JavaScript | Python |
gcd (greatest common divisor) | JavaScript | Python |
palindrome | JavaScript | Python |
pandigital | JavaScript | Python |
period | JavaScript | Python |
permutation | JavaScript | Python |
phi | JavaScript | Python |
primal (prime numbers) | JavaScript | Python |
pythagorean triples | JavaScript | Python |
shapes | JavaScript | Python |
Be sure to have NodeJS installed, then run npm install
to download the JS dependencies. The main dependency for running this package is Jest because it's used to test the performance of each solution.
To run a single test suite and observe the performance of a single solution, run the Jest CLI with the question number passed as a pattern to match. For example, to test question 78, run jest question-078
.
In order to run all the tests, run jest
and observe the output.
Be sure to have Python installed.
To run a single test suite and observe the performance of a single solution, use Python's unittest CLI with the path to the question module specified by file path. For example, to test question 78, run:
python -m unittest python/questions_001_100/question_078/*_test.py
In order to run all the tests:
python -m unittest discover -p '*_test.py'
Or, you may use this npm script shorthand:
npm run test:python
Dave Maynard - GitHub