Problem 40 Solution, ~0.176 second Execution Time