Solution to Project Euler #4