Pythagorean triples: Difference between revisions
→{{header|Haskell}}: (Pruning out some redundant search space in existing contribution)
(→{{header|Haskell}}: Reformatting an existing contribution for slightly more legibility) |
(→{{header|Haskell}}: (Pruning out some redundant search space in existing contribution)) |
||
Line 1,683:
(\(_, a, b, c) -> a + b + c <= n)
[ (prim a b c, a, b, c)
| a <-
, b <-
, c <-
, a ^ 2 + b ^ 2 == c ^ 2 ]
where
xs = [1 .. n]
prim a b _ = gcd a b == 1
|