Solve p31-p33 (29 & 30 are missing in problem set)