|San José State University|
& Tornado Alley
Sum of Digits Function
The sum of the digits of a number has interesting peoperties but it is not true that the sum of the digits of a sum or product of two numbers is sum or product of the sums of the digits of the two numbers. If the process of summing digits is continued iteratively until a single digit results that single digit is called the digit sum of the number. Denotes the digit sum of a number N as ds(N). This function does have the nice properties
For examples, consider 123 and 987. The sum of the digits of 123 is 6 and this is the digit sum of 123. The sum of the digits of 987 is 24 and the sum of the digits of 24 is 6. Thus 6 is the digit sum of 987. The sum of 123 and 987 is 1110, whose digit sum is 3. The sum of the digit sums of 123 and 987 is 12, whose digit sum is 3. The product of 123 and 987 is 121401, whose sum of digits is 9, The product of the digit sums of 123 and 987 is 36, whose digit sum is 9.
The sum of digits function does not have beautiful properties of the digit sum function but there are some notable features. Let SD( ) denote the sum of digits function.
A number to base ten is a polynomial in powers of ten, say
where the coefficients are digits in the range 0 to 9.
The sum of the digits of N is
If we were to mulitply N by 3 the sum of the polynomial coefficients would be 3SD(N). But multidigit coefficients are not allowed in the decimal representation of a number. If a product coefficient has a ten's digit then that ten's digit is carried forward to next higher power of ten. If a coefficient of a power of ten has a ten's digit of q then the coefficient of that power of ten is reduced by 10q and the coefficient of the next higher power of ten is increased by q for a net decrease in the sum of the digits of 9q.
So we can say
where Q and R are the amount carried forward in N+M and N*M, respectively.
For illustration take 134 and 672. Their sum is obtained as
1 134 672 ____ 806
The sum of the digits of the sum is 14. The sum their sums of digits is 23. There was a carry of 1 so the sum of digits of the sum should be 23−9*1=14 and it is.
The product of 134 and 672 can be computed as
134 672 ____ 268 938 804 _____ 90048
A careful tabulation reveals there were 11 units carried over. The product of the sums of digits is 8*15=120 This minus;9*11 gives 21. This is in deed the sum of the digits of the product.
Another way the relationship may be expressed is as
The expression (a = b mod k) means (a-b) is an exact multiple of k.
These relations generalize to numbers over any base.
HOME PAGE OF Thayer Watkins