problem 16 with bonus solution