Project Euler: Problem 6