improving performance for factorizing
Fixing cases where the maximum prime factor is 1