The task of Shor’s factorization algorithm (SFA) is to find a non-trivial factor of a given composite number N. In the algorithm, it is explicitly required that the constructor f (x) = a x mod N cycle is an even number, otherwise it returns to the algorithm header to recalculate. According to the analysis of the principle of SFA, the characteristics of RSA public key cryptosystem and a large number of calculation results, the random selection of a value is related to the obtained period. Aiming at this defect, a new optimization scheme is proposed on the basis of the previous optimization, and the odd cycle obtained when a is a perfect square number randomly becomes effective. When the arbitrarily chosen value of a obtains a period that is a multiple of 3, by modifying the decomposition method, the requirements for the period are relaxed without affecting the algorithm complexity. Using the classic algorithm, we experimentally prove the effectiveness of the improved algorithm, and the new algorithm significantly reduces the probability of repeated operations.