# Rules for divisibility based on digit sum in general basis.

When I was a kid I learned about the rule which says that if a number has a decimal digit sum divisible by $3$, then it is divisible by $3$. For example $123$ has digit sum $6$ and is $3\times 41$ whereas $321$ also has digit sum $6$ and is $3\times 107$.

Now to my question...

Does there exist any general result where if working in an integer base $b$:

$$n = \sum_k d_k b^k$$

If the sum of digits $\sum_k d_k$ can tell us whether $n$ is divisible by some integer (except for the trivial $b^m$, of course)

Observe that $b^k-1$ is divisible by $b-1$, so $b-1$ divides $n$ if and only if $b-1$ divides $\sum_k d_k$.
Not that useful for $b=2$. In the case $b=10$ you get standard divisibility by $9$.
Similarly, $b+1$ divides $n$ if and only if $b+1$ divides $$\sum_k (-1)^kd_k$$
• But the second one helps for example $b = 2^2 = 4$ to check divisibility by $5$ by grouping the bits two-by-two. – mathreadler Dec 17 '17 at 8:18