Problem 249. Project Euler: Problem 9, Pythagorean numbers
A Pythagorean triplet is a set of three natural numbers, a b c, for which,
a^2 + b^2 = c^2
For example,
3^2 + 4^2 = 9 + 16 = 5^2 = 25.
There exists exactly one Pythagorean triplet for which a + b + c = N (the input).
Find the product abc.
Solution Stats
Problem Comments
-
6 Comments
Show
3 older comments
Srishti Saha
on 13 Oct 2018
@ Doug Hall, I have solved all the problems in the series. However, I have not received the badge and the associated scores on completion of the series. Can you please help me with this?
Brandon
on 23 May 2023
Wow, all the triangles are in the ratio of 8:15:17? Pretty huge oversight.
Christos Saragiotis
on 26 Nov 2023
People have realized that all test cases are based on the primitive Pythagorean triplet (8, 15, 17) and the solutions are full of hacks. This is quite annoying as one cannot compare one's solution with other valid ones.
Solution Comments
Show commentsGroup

Project Euler I
- 10 Problems
- 852 Finishers
- Project Euler: Problem 1, Multiples of 3 and 5
- Project Euler: Problem 2, Sum of even Fibonacci
- Project Euler: Problem 3, Largest prime factor
- Project Euler: Problem 4, Palindromic numbers
- Project Euler: Problem 5, Smallest multiple
- Project Euler: Problem 6, Natural numbers, squares and sums.
- Project Euler: Problem 7, Nth prime
- Project Euler: Problem 8, Find largest product in a large string of numbers
- Project Euler: Problem 9, Pythagorean numbers
- Project Euler: Problem 10, Sum of Primes
Problem Recent Solvers1300
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!