Problem 9
A Pythagorean triplet is a set of three natural numbers, a b c, for which,
a 2 + b 2 = c 2
For example, 32 + 42 = 9 + 16 = 25 = 52.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc. JAVA:
public class P009 {
public static void main(String[] args){ int a=0,b=0,c=0; int n = 0; for(int i = 1;i<334;i++){ for(int j=i+1;j<1000;j++){ n = 1000-i-j; if(i*i+j*j==n*n){ a = i; b = j; c = n; break; } } } System.out.println(a*b*c); }}