move prime factor code into module