fork download
  1. import Control.Monad
  2. main = mapM_ print $ findTriples 100
  3. findTriples :: Int -> [(Int, Int, Int)]
  4. findTriples n = [(a, b, c) | c <- [1..n], b <- [1..c], a <- [1..b], a^2 + b^2 == c^2]
Success #stdin #stdout 0s 4688KB
stdin
Standard input is empty
stdout
(3,4,5)
(6,8,10)
(5,12,13)
(9,12,15)
(8,15,17)
(12,16,20)
(15,20,25)
(7,24,25)
(10,24,26)
(20,21,29)
(18,24,30)
(16,30,34)
(21,28,35)
(12,35,37)
(15,36,39)
(24,32,40)
(9,40,41)
(27,36,45)
(30,40,50)
(14,48,50)
(24,45,51)
(20,48,52)
(28,45,53)
(33,44,55)
(40,42,58)
(36,48,60)
(11,60,61)
(39,52,65)
(33,56,65)
(25,60,65)
(16,63,65)
(32,60,68)
(42,56,70)
(48,55,73)
(24,70,74)
(45,60,75)
(21,72,75)
(30,72,78)
(48,64,80)
(18,80,82)
(51,68,85)
(40,75,85)
(36,77,85)
(13,84,85)
(60,63,87)
(39,80,89)
(54,72,90)
(35,84,91)
(57,76,95)
(65,72,97)
(60,80,100)
(28,96,100)