Solve problem 31 using Clojure.