answer to projectEuler in javascript