Project Euler solutions in js