RosettaCodeData/Task/Pythagorean-triples/Scheme/pythagorean-triples.ss
2023-07-01 13:44:08 -04:00

12 lines
271 B
Scheme

(use srfi-42)
(define (py perim)
(define prim 0)
(values
(sum-ec
(: c perim) (: b c) (: a b)
(if (and (<= (+ a b c) perim)
(= (square c) (+ (square b) (square a)))))
(begin (when (= 1 (gcd a b)) (inc! prim)))
1)
prim))