Solve problems 28,30 using Erlang.