Small collection of JavaScript solutions for the first 10 Project Euler problems. Each problem is implemented as a separate, standalone script that prints example outputs to the console.
- Install Node.js (v12+ recommended).
From the project root run any problem script with Node.js. For example:
node problem1.js
node problem10.js
- problem1.js: Multiples of 3 or 5 — sum multiples below a given limit.
- problem2.js: Even Fibonacci Numbers — sum even Fibonacci numbers up to a limit.
- problem3.js: Largest Prime Factor — find the largest prime factor of a number.
- problem4.js: Largest Palindrome Product — largest palindromic product from two n-digit numbers.
- problem5.js: Smallest Multiple — least common multiple of numbers 1..n using GCD/LCM.
- problem6.js: Sum Square Difference — difference between square of sum and sum of squares.
- problem7.js: 10001st Prime — find the nth prime using a sieve.
- problem8.js: Largest Product in a Series — greatest product of n adjacent digits.
- problem9.js: Special Pythagorean Triplet — find the product abc where a+b+c = n.
- problem10.js: (Project Euler Problem 10) — sum of primes below a given limit.
- Each script is standalone and prints example outputs with
console.log. - These are intended as learning exercises and are not optimized for large-scale benchmarking.
Feel free to open issues or submit improvements ( performance, tests, or more examples ).
These files are JavaScript solutions to the Project Euler problems, each implemented in a separate file.