problem 29 is much faster