module Main where is_int num = num == fromInteger (round num) -- this is a kludge - does haskell let us search an iterator? pythagorean_triples = [(a, b, c) | b <- [1..], a <- [1..b], let c = sqrt (a * a + b * b), is_int c && (a + b + c == 1000.0) ] main = do print $ (\(a, b, c) -> a * b * c) $ last $ take 1 pythagorean_triples