Project Euler problem resolution