Friday 3 November 2017

summation - Proof for sum of digits of a number until sum is a single number

Here is a more elaborate description of the problem statement. What I found with a few examples is that given a number, say 569. If we are required to sum its digits repetitively until the sum is single digit, i.e



1)5+6+9 = 20;
2)2+0 = 2
where 2 is single digit sum


We can compute the result, 2, with just one run through the number as follows:




1) 5+6 = 11 // adding first 2 digits of 569
2) 1+1 = 2 // adding the sum of 5,6 since its more than 1 digit
3) 2 + 9 = 11 // adding the sum of digits of 11 to 9, the last digit of 569
4) 1 + 1 = 2 // summing the digits of result of step 3
which yields the same result, 2.


Could someone prove mathematically(or otherwise) why this works?
OR

provide an example where it won't work? I'm pretty sure it works all the time but don't have a proof..



Edit 1:
@Mark Bennet. Thanks for your answer. I was able to fill in the gaps and understand why the answer can be derived directly from the initial positive number using modulo 9. I will write out the proof after telling what I didn't understand.



Let original number be n.
I understood that the answer would be x = n%9 if x > 0 and 9 if x = 0;



However, what I didn't understand is, why when going by the less efficient way of repetitively summing the digits of the numbers, the order of adding the digits does not matter.




Proof of what I got from your explanation:



Let n be original number, s1, s2, s3, ..., sk be the sums formed by adding the digits. Let sk be single digit.
We know what n-s1, s1-s2, s2-s3 are all divisible by 9 because of your explanation. So we can add them all up, cancelling s1,s2, ..., sk-1j, until we are left with just n-sk which is also divisible by 9.



So, we can write n = 9p+sk where p >=0. By definition, sk is n%9.



What I didn't understand, (or rather connect this proof to) what my question is initially seeking an answer for: If I still went by my way of adding digits repetitively, why does the order of adding digits not matter?

No comments:

Post a Comment

real analysis - How to find $lim_{hrightarrow 0}frac{sin(ha)}{h}$

How to find $\lim_{h\rightarrow 0}\frac{\sin(ha)}{h}$ without lhopital rule? I know when I use lhopital I easy get $$ \lim_{h\rightarrow 0}...