prime factor function