Solution of Project Euler #8