View Problem: Sum of Digits
The value of the number abc is equal to 100*a + 10*b + c. Similarly, the value of def is equal to 100*d + 10*e + f. Adding these two gives us 100*(a+d) + 10*(b+e) + (c+f), which is the value of ghij. Let us try to represent g, h, i and j in terms of a, b, c, d, e and f:
Case 1: (a+d) < 10, (b+e) < 10, (c+f) < 10
For this case,
So, g + h + i + j = a + b + c + d + e + f. Hence (a + b + c + d + e + f) % 9 = (g + h + i + j)%9
Case 2: (a+d) >= 10, (b+e) < 10, (c+f) < 10
For this case,
If we prove that (a + b + c + d + e + f - (g + h + i + j)) % 9 = 0, we are done.
Similarly, the proof can be continued for all cases, and generalized as well.
The value of the number abc is equal to 100*a + 10*b + c. Similarly, the value of def is equal to 100*d + 10*e + f. Adding these two gives us 100*(a+d) + 10*(b+e) + (c+f), which is the value of ghij. Let us try to represent g, h, i and j in terms of a, b, c, d, e and f:
Case 1: (a+d) < 10, (b+e) < 10, (c+f) < 10
For this case,
- g = 0
- h = a+d
- i = b+e
- j = c+f
So, g + h + i + j = a + b + c + d + e + f. Hence (a + b + c + d + e + f) % 9 = (g + h + i + j)%9
Case 2: (a+d) >= 10, (b+e) < 10, (c+f) < 10
For this case,
- g = 1
- h = (a+d)%10
- i = b+e
- j = c+f
If we prove that (a + b + c + d + e + f - (g + h + i + j)) % 9 = 0, we are done.
(a + b + c + d + e + f - (g + h + i + j)) % 9
= (a + b + c + d + e + f - (1 + (a+d)%10 + b+e + c+f)) % 9
= (a + d - 1 - (a+d)%10) % 9
= (10-1) % 9 //(a+d)-(a+d)%10 = 10 as a, d lie in [0..9] so (a+d) lies in [0..18]
= 9 % 9
= 0
Hence proved for this case.Similarly, the proof can be continued for all cases, and generalized as well.
No comments:
Post a Comment