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 new problems on the original page of Project Euler.
Enjoy these solutions? Help keep this project caffeinated!
Your support fuels:
✅ New problem solutions beyond #100
✅ Performance optimizations
✅ Educational explanations
Every coffee helps! 🙏
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/Project-Euler-JS/project-euler-js.git
-
Navigate to the project directory:
cd project-euler-js cd problems
-
Run a solution (example with Problem 1):
node problem_1.js
-
Install Node.js if needed:
Download it from here.
Contributions are welcome! If you have a more efficient solution or improvement:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature-name
). - Commit changes (
git commit -m 'Add solution for problem X'
). - Push to the branch (
git push origin feature/your-feature-name
). - Open a pull request.
MIT License - see LICENSE.