# Remainder when a number is divided by its sum of the digits.

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.

• Can't you just brute force it? A programm that tests all 100 possibilities can be written very quickly... – 5xum Sep 30 '15 at 14:22
• – Barry Cipra Sep 30 '15 at 14:37

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$).