recursive solutions to problem 14