Solve problem 65 using Erlang.