TITLE: How to solve this algorithmic math olympiad problem?
QUESTION [25 upvotes]: So, today we had a local contest in my state to find eligible people for the international math olympiad "IMO" ... 
I was stuck with this very interesting algorithmic problem:
Let $n$ be a natural number ≥ 2, we take the biggest divisor of $n$ but it must be different from $n$ itself, subtract it from $n$. We repeat this until we get $1$.
Example: Let $n = 30$. Then we have to subtract its biggest different divisor, that is, 15. So 30 - 15 = 15, now we do the same: 

5 is the biggest divisor for 15, so 15 - 5 = 10
5 is the biggest divisor for 10, so 10 - 5 = 5 
1 is the greatest divisor for 5, so 5 - 1 = 4
2 is the biggest divisor for 4 so 4 - 2 = 2
1 is the biggest divisor for 2, so 2 - 1 = 1 . 

And we're done ! it took 6 steps to get 1. 
If  $n = 2016^{155}$ how many steps we have to get 1 at the end ?
I'm a programmer, and I used to rock with logical puzzles, but this time I'm completely lost. So please help me.

REPLY [16 votes]: $2016 = 2 * 2 * 2 * 2 * 2 * 3 * 3 * 7$ . Therefore 
$2016^{155} = 2^{775} · 3^{310} ·7^{155}$
Now ask yourself: What's the biggest factor of $2^{775}· 3^{310} ·7^{155}$? Obviously it's $2^{774} ·3^{310} ·7^{155}$. Subtract from the original number, and $2^{774}· 3^{310} ·7^{155}$ remains. The same thing will happen exactly $775 $ times, and then you will be left with $3^{310} ·7^{155}$ after $775$ subtractions. 
What's the biggest factor of $3^{310}· 7^{155}$? The biggest factor is $3^{309} ·7^{155}$. Subtract this and the remainder is $2 · 3^{309} ·7^{155}$. That again has the largest factor $3^{309} ·7^{155}$. Subtract this again and the remainder is $3^{309} ·7^{155}$. With two subtractions we divided by $3$ . We repeat $310$ times for a total of $620$ subtractions and the remainder is $7^{155}$.
Now the largest divisor is $7^{154}$; subtracting this leaves $6 · 7^{154}$. Now the largest factor is $3 · 7^{154}$ leaving $3 · 7^{154}$. Then the largest factor is again $7^{154}$, leaving first $2 · 7^{154}$ then $7^{154}$. $4$ subtractions to divide by $7$ . We repeat a total of $155$ times, for $620 $subtractions, arriving at $1$ . In Total $775 + 620 + 620 = 2015 $ subtractions.