Euler 2 & 3 complete in javascript