Added solution to Euler's 39th problem