Finished Project Euler problem 3 js