Solving Project Euler Problems in Javascript