Sixth problem from ProjectEuler.net