• + 0 comments

    clojure code

    (defn nth-term 
        [x n]
        (reduce (fn [acc el]
            (/ (* acc x) el)) 1 (range 1 (inc n))))
    
    (defn exponential 
        [x]
        (reduce (fn [acc el]
            (+ acc (nth-term x el))) 1 (range 1 10)))