(defn gcd [a b] (if (zero? b) a (recur b (mod a b)))) (defn pyth [peri] (for [m (range 2 (Math/sqrt (/ peri 2))) n (range (inc (mod m 2)) m 2) ; n> peri pyth rcount) produces [total, primitive] counts (reduce (fn [[total prims] t] [(inc total), (if (first t) (inc prims) prims)]) [0 0] ts))