Problem 39 Solution, ~5.61 second Execution Time