Aug. 29th, 2014

orleanz: (main)
There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find abc.

A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a^2 + b^2 = c^2

limit = 1000
result = head [
(prod, (x, y, z)) | x <- [1..limit], y <- [1..limit], 
let z = limit - x - y, z > 0, x*x + y*y == z*z, let prod = x*y*z
]

Profile

orleanz: (Default)
orleanz

December 2018

S M T W T F S
      1
2345678
9101112 131415
16171819202122
23242526272829
3031     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 22nd, 2025 01:03 pm
Powered by Dreamwidth Studios