Solve problem 53 using Erlang.