Project Euler: Problem 3