Problem 39 in Ruby.
Problem 44 in progress