JS prime factor finder