solved problem 8 of Project Euler