Problem 41 Solution, ~100 second Execution Time