That is the problem:
![](https://i0.wp.com/www.raucci.net/wp-content/uploads/2021/09/Schermata-2021-09-27-alle-19.56.05.jpg?resize=1024%2C312)
We can solve the problem by writing a Python code.
Let’s start with a function that checks if the three numbers \(a,b,c\), with \(a<b<c\), are a Pythagorean triplet.
def is_triplet(a,b,c):
if (a**2 + b**2) == c**2:
return(True)
else:
return(False)
Now, let’s move on to defining the main function:
def main(sum_value):
for c in range(sum_value):
for b in range(c):
for a in range (b):
if (a+b+c) == sum_value:
if is_triplet(a,b,c):
print(a,b,c)
print(a*b*c)
and then, the main program:
sum_total = 1000
main(sum_total)
This is the answer:
![](https://i0.wp.com/www.raucci.net/wp-content/uploads/2021/09/Schermata-2021-09-27-alle-20.12.01.jpg?resize=860%2C310)