Understanding the digit sum calculator — concept and principle
This calculator adds the digits of a number and uses the result for quick divisibility tests by 3 and 9. It also gives the number of digits, the alternating digit sum used for the test by 11, the digital root and the average digit. Use it for number puzzles, checking arithmetic and divisibility homework.
How it is calculated
Digit sum = sum of all the digits
Alternating digit sum = ones − tens + hundreds − … (from the right)
Digital root = repeat the digit sum until one digit remains
Average digit = digit sum ÷ number of digits
- A number is divisible by 3 (or 9) exactly when its digit sum is.
- Signs, separators and the decimal point are ignored, so the digits of 3.14 add to 8.
The principle
10 leaves a remainder of 1 when divided by 9 (and by 3), so 100, 1,000 and every power of 10 do too. A number such as 98,765 = 9 × 10,000 + 8 × 1,000 + … therefore has the same remainder as 9 + 8 + 7 + 6 + 5. That is why the digit sum tests divisibility by 3 and 9, and why "casting out nines" checks sums and products. For 11, the powers of 10 leave remainders 1 and −1 alternately, which gives the alternating sum.
Worked example
Default input: 98,765.
- Digits added: 9 + 8 + 7 + 6 + 5 = 35, from 5 digits.
- 35 is not a multiple of 3 or 9: not divisible by 3 or by 9.
- Alternating sum from the right: 5 − 6 + 7 − 8 + 9 = 7, not a multiple of 11, so 98,765 is not divisible by 11 either.
- Digital root: 35 → 3 + 5 = 8.
- Average digit = 35 ÷ 5 = 7.
| Number | Digit sum |
|---|---|
| 24,691 | 25 |
| 49,382 | 31 |
| 74,074 | 29 |
| 98,765 | 35 |
| 123,456 | 21 |
| 148,148 | 26 |
| 197,530 | 25 |
How to read the result
The digit sum is a quick check, not a value in its own right. If you change the order of the digits, the digit sum and the divisibility by 3 and 9 do not change. Remainders carry over too: 98,765 leaves remainder 8 when divided by 9, the same as its digital root.
Common mistakes
- Using the digit sum to test divisibility by numbers other than 3 and 9.
- Starting the alternating sum from the left with an even number of digits, which can flip the sign.
- Counting a minus sign or decimal point as a digit.
- Confusing the digit sum with the digital root.
Frequently asked questions
How do I know if a number is divisible by 3?
Add its digits; if the total is divisible by 3, so is the number.
What is the digit sum of 98,765?
35.
What is casting out nines?
A check of arithmetic using digit sums modulo 9.
Sources: OpenStax, Prealgebra 2e (2020), §2.4 Find Multiples and Factors · E. W. Weisstein, "Digital Root", Wolfram MathWorld