Determine all pairs $(a, b)$ for which $s (an + b) - s (n)$ assumes finitely many values

212 Views Asked by At

For every positive integer n we define $s (n)$ as the sum of the digits of $n. $ Determine all pairs $(a, b)$ of positive integers for which$$s (an + b) - s (n)$$assumes a finite number of values by varying $n$ in positive integers.

Solution: The solution is $a = 10^k, 1 \le b < 10^k$ for $k \ge 1.$ This clearly works: $s(10^k n) = s(n),$ and adding $b$ on only affects the last $k$ digits, which are all zeroes, so $0 \le s(10^k n + b) - s(n) \le 9k.$

If $a$ is not of the form $2^u 5^v,$ let $n = \lceil 10^m / a \rceil.$ Now $10^m + b \le an+b \le 10^m + (a+b)$ means that $an+b$ is $1$ followed by a bunch of zeroes followed the expansion of $k$ for $b \le k \le a+b$ for $m$ large enough. Thus, $s(an+b) \le 1 + s(M)$ where $M = \max\limits_{a \le i \le a+b} s(i).$ However, $s(\lceil 10^m / a \rceil)$ is unbounded* as $m$ increases, contradiction.

Suppose $a = 2^u 5^v.$ If $u \ne v,$ WLOG $u>v$ (other case is similar). Let $c_m = (10^m - 1)/9.$ Take $n = 10^{r-v}c_m$ so that $s(n) = m.$ We want to show $s(2^u 5^v n+b) = s(10^r 2^{u-v} c_m + b) \ge cm$ for some $c>1$ for $m$ large enough (this part is incomplete). Let $t = u-v > 0$ and take $r$ large enough so that $s(10^r 2^{u-v} c_m + b) = s(2^t c_m + b).$ Now we want to show $s(2^t c_m + b) \ge cm$ for some $c>1$ for $m$ large enough.

The expansion of $2^t c_m$ is a bunch of junk digits followed by a long repetition of the same digit, followed by some junk at the end from $b.$ We can take $t$ large enough to ignore the junk, so we just require that the repeating digit is not $1.$ For example, $111,111,111,111 \cdot 128 = 14,222,222,222,208$ and we ignore the $14, 08$ at the start and end. This rules out $t=7.$ But we cannot rule out every $t.$ For example, $111,111,111,111 \cdot 64 = 7,111,111,104.$ Now the junk is $7, 04$ but the main string is all ones. In these cases, we go back to the start and take $c_m = 2(10^m - 1)/9$ instead, resolving the issue. This should be the last fix to the proof.

Now if $a = 10^k,$ let $n = 10^m - 1$ so that $an+b = 10^{m+k} + (b-10^k)$ and $s(n) = m$ is unbounded. For $m$ large enough and $b \ge 10^k,$ $an+b$ is $1$ followed by a bunch of zeroes followed by the expansion of $b-10^k.$ Thus, $s(an+b) = 1 + s(b-10^k),$ which is bounded, contradiction.

Proof of $(*)$: We are essentially doing long division on $1/a$ with a decimal shift. The decimal expansion does not terminate unless $a = 2^u 5^v$ for $u, v \ge 0,$ so the sum of digits after a decimal shift is unbounded as $m$ increases and reveals more decimal places.

Any more elegant solution than this?

2

There are 2 best solutions below

0
On BEST ANSWER

If $a \ne 10^k$, then choose $L$ greater than both $a$ and $b$ and let $n=10^L+10^{2L}+... +10^{mL}$. Then $S(an+b)-S(n)=m(S(a)-1)+S(b)$ takes infinitely many values.

If $a =10^k$ and $b\ge a$, then choose $m$ greater than $k$ and let $n=10^m-1$. Then $S(an+b)-S(n)=1+S(b-10^k)-9m$ takes infinitely many (negative) values.

If $a =10^k$ and $b<a$, then $S(an+b)-S(n)=S(b)$ takes only one value.

0
On

There seems to be a gap in the part where you rule out $u \neq v$: Taking $c_m = 2 (10^m-1)/9$ doesn't always solve the issue, because $s(c_m)$ is also twice as large.

Instead, you should take a completely different $c_m$, depending on $u-v$. In fact, we can rule out the whole case $a \neq 10^k$ at once:

Suppose $a$ is not a power of $10$. Then $s(a) \geq 2$. Let $k$ be large so that $10^k > a$, $r$ such that $10^r > b$ and take $n = 10^r \cdot \sum_{j=1}^m 10^{jk}$. Then $s(n) = m$ and $s(an+b) = m \cdot s(a) + s(b)$.

Because $s(a) \geq 2$, the difference becomes very large.