Solve problem 26 using Erlang.