triplet :: (Integral a) => a -> a -> a -> Bool triplet a b c = a^2 + b^2 == c^2 p9 :: Int p9 = head [x*y*z | x <- [2..333], y <- [2..1000], z <- [333..1000], triplet x y z, x+y+z == 1000] main = putStrLn $ "Solution: " ++ show p9