RosettaCodeData/Task/List-comprehensions/Common-Lisp/list-comprehensions-3.lisp
2023-07-01 13:44:08 -04: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)))))