Project Euler done in Javascript