Definition:Digit Sum

Definition
Let $$n \in \Z: n \ge 0$$.

The digit sum of $$n$$ to base $$b$$ is the sum of all the digits of $$n$$ when expressed in base $$b$$.

That is, if:
 * $$n = \sum_{k \ge 0} r_k b^k$$

where $$0 \le r_k < b$$, then:
 * $$s_b \left({n}\right) = \sum_{k \ge 0} r_k$$

Examples
In conventional base 10 notation, we have:


 * $$s_{10} \left({34716}\right) = 3 + 4 + 7 + 1 + 6 = 21$$

In binary notation, we have:
 * $$s_{2} \left({10010111101_2}\right) = 1 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 1 = 7$$

Also see
Compare with digital root.