Saving progress with primeFactorization method