A Pythagorean triplet is a set of three natural numbers, a b
c,
for which,
a2 + b2 = c2
For example, 32 + 42 = 9 + 16 = 25 = 52.
There exists exactly one Pythagorean triplet for which a + b + c =
1000.
Find the product abc.
public class Pythagorean {
public static void main(String args[]){
for(int i=1;i<334;i++){
for(int j=2;j<1000-i;j++){
if((i*i+j*j)==(1000-i-j)*(1000-i-j)){
System.out.println("i="+i+",j="+j+",k="+(1000-i-j));
}
}
}
}
}
i=200,j=375,k=425
Answer:31875000