Definition:Digit Sum

From ProofWiki
Jump to navigation Jump to search

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:

$\ds n = \sum_{k \mathop \ge 0} r_k b^k$

where $0 \le r_k < b$, then:

$\ds \map {s_b} n = \sum_{k \mathop \ge 0} r_k$


Examples

In conventional base $10$ notation, we have:

$\map {s_{10} } {34 \, 716} = 3 + 4 + 7 + 1 + 6 = 21$


In binary notation, we have:

$\map {s_2} {10010111101_2} = 1 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 1 = 7$


Also see


Sources