This is the problem : repeatedly add all its digits until the result has only one digit.
given the arbitrary number : 96491
This is the first solution that is pretty straight forward and I can understand. The result is $2$.
$(9+6+4+9+1 = 29) => (2+9 = 11) => (1+1 = 2) => 2$
Now here is another solution that I don't understand why it works.
$(9649 + 1 = 9650) => (965 + 0 => 965) => (96 + 5 = 101) => (10+1 = 11) => (1 +1 = 2) => 2$
What just happened? as you see the steps and results during steps seems completely different. yet they always produce same result. this number was just example. it works for any given positive number (tested with program for millions of different numbers). I'm really curios why second solution works? Thanks for explanations.