program starts with n = 13^{13}
Source: 2022 Moldova JBMO TST p7
November 4, 2022
number theory
Problem Statement
A program works as follows. If the input is given a natural number (), then the program consecutively performs the following procedure: it determines the greatest proper divisor of the number (that is, different from and ) and subtracts it from the number , then applies again the same procedure to the obtained result and so on. If the program cannot find any proper divisor of the given number at a step, then it stops and outputs the total number of procedures performed (this number can be equal to ). The input was given the number . Determine the respective number at the output.