RosettaCodeData/Task/List-comprehensions/FunL/list-comprehensions.funl

4 lines
117 B
Text
Raw Permalink Normal View History

2016-12-05 23:44:36 +01:00
def triples( n ) = [(a, b, c) | a <- 1..n-2, b <- a+1..n-1, c <- b+1..n if a^2 + b^2 == c^2]
println( triples(20) )