Project Euler done in JavaScript