Problem 39 solution added. ~0.001 seconds running time.