Solution to Problem 6 of Project Euler