optimisation

improved my factor-finding code