(defn gcd [a b] (if (= b 0) a (recur b (rem a b)))) (defn totient [n] (if (<= n 1) 1 (loop [i (- n 1) a 0] (if (> i 0) (recur (- i 1) (+ a (if (= (gcd n i) 1) 1 0))) a))))

# Euler Totient in Clojure

Here’s my attempt: