Skip to content

Mamr55162/project-euler-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project Euler Solutions in C++

Project Euler's image design

A collection of my solutions to problems from the Project Euler platform using modern C++.

This repository focuses on:

  • Algorithmic problem solving
  • Mathematical programming
  • Numerical analysis
  • Optimization techniques
  • Efficient computation on large numbers
  • Time complexity improvement
  • Exploring performance limits of C++

Topics Covered

This repository includes problems involving:

  • Prime number generation
  • Sieve algorithms
  • Dynamic programming
  • Memoization
  • Number theory
  • Recursion
  • Combinatorics
  • Big integer manipulation
  • Mathematical sequences
  • Brute-force optimization
  • Search space reduction
  • Computational mathematics

Example Problems

Problem Main Concepts
Longest Collatz Sequence Memoization, Dynamic Programming
Summation of Primes Sieve of Eratosthenes
Highly Divisible Triangular Number Divisor Counting, Prime Factorization
Largest Prime Factor Number Theory
Distinct Powers Sets, Exponentiation
Special Pythagorean Triplet Mathematical Search Optimization

Repository Structure

Project_Euler/
│
├── Longest Collatz Sequence.cpp
├── Summation of Primes.cpp
├── Largest Prime Factor.cpp
├── Distinct Powers.cpp
├── ...

Optimization Techniques Used

Some solutions include optimizations such as:

  • Memoization to avoid repeated computations
  • Prime sieves instead of naive primality checks
  • Efficient divisor counting using prime factorization
  • Reduced brute-force search spaces
  • Complexity-aware implementations
  • Large integer handling strategies

Code Style

Most files contain:

  • Problem title
  • Short explanation of the approach
  • Algorithmic improvements
  • Complexity considerations
  • Clean and readable implementation

Example:

// Project Euler - Problem 14: Longest Collatz Sequence
// Uses memoization to cache previously computed chain lengths

Goals of This Repository

This repository was created to:

  • Strengthen mathematical problem-solving skills
  • Improve algorithmic thinking
  • Practice optimization techniques
  • Explore computational efficiency in C++
  • Develop cleaner and more structured implementations over time

Build & Run

Compile using g++:

g++ filename.cpp -O2

Run:

./a.out

Notes

Some problems contain multiple implementation attempts and evolving optimizations, reflecting the process of improving both mathematical reasoning and programming efficiency over time.


Future Improvements

Planned future additions:

  • More Project Euler problems
  • Benchmark comparisons
  • Alternative optimized solutions
  • Additional mathematical notes
  • Complexity analysis for all problems

About

A mathematical and algorithmic laboratory in C++ for Project Euler's website problems.

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages