Project Euler with Javascript