Project Euler solutions in javascript