Solve problem 48 using Erlang.