Could someone give me a more or less rigorous proof of the digital root formula?
I saw this question. It asks only about intuition and so, the answers there are not helpful for me to understand the formula. I guess I do not have the intuition.
Here is the formula:
$dg$ - digital root
$dg(x) = 0, if x is 0$
$dg(x) = 9, if x = 0 mod 9$
$dg(x) = x mod 9, otherwise$
While solving the problems on leetcode I was able to notice the pattern of the repetition of the digital root and devise the above algorithm. After that I checked that the algorithm is correct according to internet. But still I can not prove it to myself.
So far I was only able to understand that
$x mod 9 = (x_1 + ... + x_n) mod 9$, where $x_1, ..., x_n$ - the digits of $x$
and after that everywhere on internet they make a conclusion that the above formula was proven. But I do not understand why.
Ok, we proved the above statement, but that does not mean that for the number
$y = x_1 + ... + x_n$
holds that
$x mod 9 = y mod 9$
and even if it would hold, we would need to prove the same statement for the digits of $y$ and then for their sum and so on. And it seems impossible to do, so, I hope for another way.