solution to Problem 30