RosettaCodeData/Task/List-comprehensions/Nim/list-comprehensions-1.nim
2023-07-01 13:44:08 -04:00

10 lines
181 B
Nim

import sugar, math
let n = 20
let triplets = collect(newSeq):
for x in 1..n:
for y in x..n:
for z in y..n:
if x^2 + y^2 == z^2:
(x,y,z)
echo triplets