Added problem 31 solution.