Project Euler Problem 24