Solutions to Project Euler problems (1 to 100) in JavaScript.
This repository contains solutions to the first 100 problems from Project Euler by FreeCodeCamp, implemented in JavaScript. Each problem is solved using an efficient algorithm and well-commented code to explain the approach used. You can find a complete list of problems and news problem on the original page of the Project Euler - click me
Project Euler is a collection of challenging mathematical/computer programming problems. The goal is to develop efficient algorithms to solve the problems in a limited time.
In this repository, I've solved problems 1 through 100. These solutions aim to be both accurate and efficient. Some problems require mathematical insights, while others focus on algorithmic complexity and optimization.
Each problem has its own JavaScript file. The solutions are numbered according to the problem number (e.g., problem_1.js
, problem_2.js
, etc.). Inside each file, the solution for that specific problem is provided with a brief explanation of the approach used to solve it.
problem_1.js
: Solution for Problem 1 - Multiples of 3 and 5problem_2.js
: Solution for Problem 2 - Even Fibonacci numbersproblem_3.js
: Solution for Problem 3 - Largest prime factor- ...
To run the solutions locally, follow these steps:
-
Clone the repository:
git clone https://github.com/david15tonon/project-euler-js.git
-
Navigate to the project directory:
cd project-euler-js
-
Run a solution (example with Problem 1): You can run a specific problem file using Node.js. For example, to run Problem 1:
node problem_1.js
-
Install Node.js if needed: If you don't have Node.js installed, you can download it from here.
Contributions to this project are welcome! If you have a more efficient or improved solution for any of the problems, feel free to fork the repository, make your changes, and create a pull request.
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature-name
). - Implement your solution or improvements.
- Test the solution locally.
- Commit your changes (
git commit -m 'Add solution for problem X'
). - Push to the branch (
git push origin feature/your-feature-name
). - Open a pull request on GitHub.
This project is licensed under the MIT License - see the LICENSE file for details.
- Some solutions might take a while to run, depending on the problem's complexity. I encourage optimizing algorithms where necessary.
- Feel free to reach out if you have any questions or suggestions regarding the solutions!