problem 14 gets the answer correct now, is still slow