Euler Project solutions in js