My solution to Project Euler's question #59