Added solution to Euler problem 39