Problem 29 (inefficient)