working on problem 31
solutions to problem 31 and 32
solution to 33