improve checkNums and firstFactorial