problem 41 in clojure.
Problem 19 in ruby