Project Euler Problem 6 solution