Euler problems resolved in javascript