Answer to Project Euler