Monday, 19 December 2016

Sum of Digits

Say we have 2 numbers abc and def, where, a, b, c, d, e and f are the digits of the 2 numbers lying in [0..9]. Adding these 2 numbers gives us the number ghij. Again, g, h, i and j are the digits of the resulting number.
  abc
+ def
----------
 ghij
Can you prove that

(a + b + c + d + e + f) % 9 = (g + h + i + j) % 9 

is always true?

To understand better, let us see an example -
  379
+ 822
----------
 1201

(3 + 7 + 9 + 8 + 2 + 2) % 9 = 31 % 9 = 4
(1 + 2 + 0 + 1) % 9 = 4 % 9 = 4

Let us now generalize the above statement. Say we have N numbers A1, A2, ... AN. Let S(x) denote the sum of digits of the the number x.

Can you prove that

[S(A1) + S(A2) + .. + S(AN)] % 9 = S(A1 + A2 + .. + AN) % 9

is always true?

To put it in a single sentence, can you prove that the sum of digits of a group of numbers modulo 9 is the same as the sum of digits of the sum of those numbers modulo 9 ?

No comments:

Post a Comment