[Math] Remainder when a number is divided by its sum of the digits.

elementary-number-theory

Let $s(n)$ denote the sum of the digits of $n.$ Then find the maximum remainder when $n$ is divided by $s(n)$ if $n$ is a two digit number.

Best Answer

For two-digit numbers, the largest digit sum is $18$, which only occurs for $n=99$, but $99\bmod18=9$. This rules out $17$ as a possible answer for the largest remainder.

The digit sum $17$ occurs only for $n=98$ and $n=89$. But $98\bmod17=13$ and $89\bmod17=4$, which rules out $16$ as a possible answer.

The digit sum $16$ occurs for $97$, $88$, and $79$. Testing these, we find

$$\begin{align} 97\bmod16&=1\\ 88\bmod16&=8\\ 79\bmod16&=15 \end{align}$$

and there we have it: $15$ is the largest possible remainder (and occurs at $n=79$).

Given the erratic nature of the sequence of remainders, I don't see any easy alternative to this kind of case by case approach if, for example, you ask the same question for three-digit numbers.