Make primefactor work using factor_trial_division

Now it works robustly
Fix tests

The number of factors were incorrect in the test, e.g. 12 = 2*2*3 which is 3
factors, not 2.