Implemented Problem 34
Implemented Problem 40