A positive integer is called shiny if it can be written as the sum of two not necessarily distinct integers $a$ and $b$ which have the same sum of their digits. For instance, $2012$ is shiny, because $2012 = 2005 + 7$, and both $2005$ and $7$ have the same sum of their digits. Find all positive integers which are not shiny (the dark integers).
Problem
Source: Ibero American 2012
Tags: number theory proposed, number theory
03.10.2012 02:58
$a$ and $b$ have to be distinct?
03.10.2012 03:37
No. I edited the post
03.10.2012 04:14
The key of this problem is to think algorithmically. First I will do the case of $S(n)$ is even. Let $n = \overline{a_1a_2...a_m}$. Then $n = \overline{a_1a_2...(a_k-1)...a_m} + 10^{m-k}$ where $a_{k}$ is non-zero. Now just transfer the digits from the left number to the right number $1$ at a time, i.e. subtract one from a digit spot on the left number and add it to the right number. Eventually both numbers will have digit sum $S(n)/2$ so we're done in this case. Now consider $S(n)$ is odd and $S(n) > 1$. Clearly $n$ odd and $n < 10$ don't work so we'll assume $n$ is two or more digits long now. Again, let $n = \overline{a_1a_2...a_m}$. Consider $a_k$ as a non-zero digit where $a_{k+1}$ is not $9$. This exists as long as $n \neq \overline{a999...999}$ for some $a$ and some length. $n = \overline{a_1a_2...(a_k-1)9a_{k+2}...a_m} + (a_{k+1}+1)10^{m-k-1}$ Now just apply the same trick with the even numbers, as the left part and the right part have the same parity of digit sum so we're done in proving if $n$ is not of the form $\overline{a999...999}$ it is shiny. Now suppose $n = \overline{a999...999}$. Suppose it were shiny, then it is easy to see if $c+d=n$ then $S(c) + S(d) = S(n)$. But this implies $S(n)$ is even, thus $n = \overline{a999...999}$ and is shiny iff $S(n)$ is even. In conclusion, we have proven above $n$ is shiny iff $n$ is not of the form $\overline{a999...999}$ where $S(n)$ is odd as well.
04.10.2012 10:44
dinoboy wrote: The key of this problem is to think algorithmically. Now consider $S(n)$ is odd and $S(n) > 1$. Clearly $n$ odd and $n < 10$ don't work so we'll assume $n$ is two or more digits long now. Again, let $n = \overline{a_1a_2...a_m}$. Consider $a_k$ as a non-zero digit where $a_{k+1}$ is not $9$. This exists as long as $n \neq \overline{a999...999}$ for some $a$ and some length. $n = \overline{a_1a_2...(a_k-1)9a_{k+2}...a_m} + (a_{k+1}+1)10^{m-k-1}$ Now just apply the same trick with the even numbers, as the left part and the right part have the same parity of digit sum so we're done in proving if $n$ is not of the form $\overline{a999...999}$ it is shiny. Very nice solution, but you forgot about the case $S(n)=1$. Whatever, this is trivial, since $n$ is a power of $10$, so, it's even and every $n=2k$ can be written as $n=k+k$, and obvious it satisfies the condition.