A collection of my solutions to the first 100 Project Euler problems, written in Python. Now I am deciding to do another 100! I need something to keep me from playing games.
The goal of this project isn't just to get the correct answers. It's also an opportunity to practice writing clean, reusable, and reasonably efficient code while learning new algorithms and mathematical techniques.
Current Progress: 125/200 ✅
███████████████████████████████░░░░░░░░░░░░░░░░░░░ 62.5%
Note
This project may occasionally surprise you. If you prefer perfectly reproducible output, use
--no-easter-eggs.
- Solutions organized inside a single
EulerSolverclass - Reusable helper functions for common mathematical operations
- Automatic discovery of implemented problems
- Command-line interface powered by
argparse - Run individual Project Euler problems
- List all implemented problems
- Animated loading spinners using Halo
- Colored terminal output using Colorama
- Execution time displayed for computationally intensive problems
- Clean and readable code with docstrings
- Modular package structure (
euler_problems/) split by responsibility for easier maintenance - Data files installer that is inspired by the
dnfpackage manager
| Problem | Description | Status |
|---|---|---|
| 0 | Sum of odd perfect squares up to 756000 | ✅ |
| 1 | Multiples of 3 or 5 | ✅ |
| 2 | Even Fibonacci Numbers | ✅ |
| 3 | Largest Prime Factor | ✅ |
| 4 | Largest Palindrome Product | ✅ |
| 5 | ✦ Smallest Multiple | ✅ |
| 6 | Sum Square Difference | ✅ |
...
Check PROBLEMS for the full completed list
✦ Some solved problems contain optional surprises.
Note: Problem 0 is the starting challenge for account creation
EulerProblems.py (Thin entry point - run this, same CLI as always)
ci_smoke.py (The CI test script to make sure everyting works)
requirements.txt (The requirements)
euler_problems/ (Package containing all solver logic)
__init__.py (Dependency check + package exports)
exceptions.py (Custom exception hierarchy)
data.py (Large static data blobs - problems 8, 11, 13, 18, etc.)
helpers.py (CLI/output helpers - spinners, progress bar, etc.)
utils.py (Reusable math helper functions)
easter_eggs.py (Hidden easter egg behavior)
problems_00_25.py (Solutions: problem0 - problem25)
problems_26_50.py (Solutions: problem26 - problem50)
problems_51_75.py (Solutions: problem51 - problem75)
problems_76_100.py (Solutions: problem76 - problem100)
problems_101_125.py (Solutions: problem101 - problem125)
problems_test.py (Debug options/testing for errors)
solver.py (EulerSolver class, combining everything above)
cli.py (argparse setup + main entry point)
README.md (This file)
LICENSE.txt (The MIT License)
This project used to live entirely inside one ~3,100-line file. It's now split
across the euler_problems/ package, with each piece combined into a single
EulerSolver class via mixins:
- Utility/helper methods →
helpers.py,utils.py - Hidden easter eggs →
easter_eggs.py - Individual Project Euler solutions →
problems_00_25.py,problems_26_50.py,problems_51_75.py,problems_76_100.py - Runner / CLI →
solver.py,cli.py
Nothing changes about how you run it - python EulerProblems.py ... still works
exactly like before; it's now just a thin entry point into the package.
Python 3.10+ is supported, with Python 3.14+ recommended for the best experience.
Install dependencies:
pip install -r requirements.txtInstall data files (optional if you don't need to run problems that require them):
python EulerProblems.py installPrints out a help message:
python EulerProblems.pyRun every implemented Project Euler solution:
python EulerProblems.py --allExecute one or more individual problems by specifying their numbers.
python EulerProblems.py 1python EulerProblems.py 1 5 10 15View every currently implemented Project Euler problem.
python EulerProblems.py --listor
python EulerProblems.py -lExample output:
Implemented Problems
0 - Find the sum of all odd perfect squares up to 756000
1 - Find the sum of all multiples of 3 or 5 below 1000
2 - Find the sum of all even Fibonacci numbers below 4 million
...
XX - Latest implemented problem
List all debug options currently implemented, select the option by inputing the corresponding number.
python EulerProblems.py debugMany Project Euler problems reuse common algorithms. Instead of rewriting code, helper methods are shared across multiple solutions.
Current helper functionality includes:
- Prime number generation
- Sieve of Eratosthenes
- Prime factorization
- Fibonacci generation
- Palindrome checking
- Divisor counting
- Dynamic programming
- Mathematical utilities
- And more as new problems require them.
Finish all 100 Project Euler problems while continually improving:
- Python knowledge
- Algorithm design
- Mathematical problem solving
- Runtime efficiency
- Code readability
This is currently complete. This repository is still being maintained and adding new problems. Check PROBLEMS for a list of all problems that has been completed
- Command-line interface
- Run individual problems
- List implemented problems
- Debug options
- Benchmark mode
- Automatic answer verification against Project Euler answers
- Export benchmark results to CSV
- Unit tests
- Downloading data from the official webiste
- Progress statistics
- Separate helper functions into their own module
- Split codebase into multiple modules
Project Euler offers problems that combine mathematics with programming. Rather than simply obtaining the correct answer, this project focuses on writing solutions that are:
- Readable
- Reusable
- Efficient
- Well documented
- Easy to benchmark and improve over time
Every solved problem is another opportunity to learn something new.
This project contains a handful of hidden easter eggs for those who are lucky enough to find them.
By default, easter eggs have a small chance of appearing during the execution of certain Project Euler problems.
If you would like deterministic output for benchmarking, screenshots, or automated testing, you can disable them:
python EulerProblems.py --no-easter-eggsHint: At least one easter egg is hidden in Problem 39...
This project is released under the MIT License.