MathDB
Israel 2016 Q3 - Summing digits repeatedly

Source: Israel National Olympiad 2016 Q3

August 7, 2019
sum of digitsnumber theoryDigitsmodular arithmeticdigit sum

Problem Statement

Denote by S(n)S(n) the sum of digits of nn. Given a positive integer NN, we consider the following process: We take the sum of digits S(N)S(N), then take its sum of digits S(S(N))S(S(N)), then its sum of digits S(S(S(N)))S(S(S(N)))... We continue this until we are left with a one-digit number.
We call the number of times we had to activate S()S(\cdot) the depth of NN.
For example, the depth of 49 is 2, since S(49)=13S(13)=4S(49)=13\rightarrow S(13)=4, and the depth of 45 is 1, since S(45)=9S(45)=9.
[*] Prove that every positive integer NN has a finite depth, that is, at some point of the process we get a one-digit number. [*] Define x(n)x(n) to be the minimal positive integer with depth nn. Find the residue of x(5776)mod6x(5776)\mod 6. [*] Find the residue of x(5776)x(5708)mod2016x(5776)-x(5708)\mod 2016.