=begin A Pythagorean triplet is a set of three natural numbers, abc, for which, a² + b² = c² For example, 3² + 4² = 9 + 16 = 25 = 5². There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. =end 1.upto 1000 do |c| 1.upto c do |b| 1.upto b do |a| if a+b+c == 1000 if a**2 + b**2 == c**2 print(a.to_s+'x'+b.to_s+'x'+c.to_s+'='+(a*b*c).to_s) exit end end end end end