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

6 lines
179 B
Common Lisp

(defun pythagorean-triples (n)
(listc (list x y z)
(for x from 1 to n)
(for y from x to n)
(for z from y to n)
(when (= (+ (expt x 2) (expt y 2)) (expt z 2)))))