top of page

Problem 09

This is a C++ solution to Project Euler problem 09 found at: https://projecteuler.net/problem=9

My Algorithm

For this problem, we need to find the only Pythagorean triplet where a + b + c = 1000 and return the product of a, b, and c. For this problem, we can simply create a nested for-loop that loops through all possible combinations of a, b, and c. Then, inside the loop, we can check if (a^2 + b^2 = c^2) and if (a + b + c = 1000). If both of these conditions are met, then we can return the current value of (a * b * c), which is 31875000.

Full Solution on GitHub

© 2023 by Matthew Woodring

    bottom of page