RosettaCodeData/Task/List-comprehensions/Common-Lisp/list-comprehensions-1.lisp
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

6 lines
278 B
Common Lisp

(defun pythagorean-triples (n)
(loop for x from 1 to n
append (loop for y from x to n
append (loop for z from y to n
when (= (+ (* x x) (* y y)) (* z z))
collect (list x y z)))))