Problem Two of Project Euler