Incorrect answer for Prob 18

Yeah, I'm a bonehead. I should have known it wouldn't be this simple.
But, the function may be useful later.