article

In mathematics, the digit sum of a given integer is the sum of all its digits, e.g. the digit sum of 12042 is calculated as 1+2+0+4+2 = 9.

The digit sum of a base 10 integer, x, repeated until a single digit is produced, can be calculated as digit_sum(x) = x mod 9. For example, digit_sum(632) would reduce 6+3+2 = 11 to 1+1 = 2. The function returns 0 when the digit sum is 9 (or 0 as in the case of digit_sum(0)). This is also called "casting out nines".

Using alternating addition and subtraction, rather than addition alone, produces residues modulo eleven. The least significant digit should be added, the 10s digit subtracted, and so on, making it more convenient to work right-to-left. Thus 12042 produces 2−4+0−2+1 = −3, or 8 modulo 11.

See also: digital root.

External link


Quersumme | Þversumma | Tværsum

 

This article is licensed under the GNU Free Documentation License. It uses material from the "Digit sum".

Home Pageartsbusinesscomputersgameshealthhospitalshomekids & teensnewsphysiciansrecreationreferenceregionalscienceshoppingsocietysportsworld