Only after he had spent several nights working on the math problem _______ to wonder whether the problem was wrongly set.