Let $q$ be a non-negative integer $\geq 2.$ For a non-negative integer $n$ It is known that there exixts a unique sequence of integer $0\leq n_k \leq q-1$ such that $$n=\sum_{k=0}^{+\infty} n_k q^k.$$ The sum of digits of $n$ in basis $q$ is denoted by $S_q(n)$ and defined by $$S_q(n):=\sum_{k=0}^{+\infty} n_k.$$ Kevin G. Hare, Shanta Laishram, and Thomas Stoll proved in [Proposition 2.2, STOLARSKY’S CONJECTURE AND THE SUM OF DIGITS OF POLYNOMIAL VALUES] the following:
The function $S_q$ is subadditive, i.e., for all $a,$ $b \in N$ we have $$S_q(a+b)\leq S_q(a)+S_q(b). $$ The proof follows on the lines of [T. Rivoal, On the bits counting function of real numbers, Section 2]. An even stronger result is true, namely that $$S_q(a+b)=S_q(a)+S_q(b)-(q-1).r (*),$$ where $r$ is the number of ''carry'' operations needed when adding $a$ and $b$. I read Rivoal's paper which investigates the case when $q=2$ (binary representation of an integer) but I couldn't find the exact value of $r$ in formula (*). Can someone help me with finding the explicit realtion between $S_q(a+b)$ and $S_q(a)$ and $S_q(b)$.
Many thanks.