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).
Let the number being investigated be n.
Let the sum of digits of n be SOD(n)
Let a=(n-1)/2
Let b=(n+1)/2
I SOD(a)+SOD(b)=SOD(n)+9r, r in Z
On each of k steps, add 1 to a and deduct 1 from b
II SOD(a+k)+SOD(b-k)=SOD(n)+9s, s in Z
Let k=5
Now (a+5)=(b-5)+9;
And SOD(a+k)+SOD(b-k)=SOD(n) or SOD(n)+/-9s (II)
This is necessarily a solution unless:
(i) (b-5) is negative (i.e.1,3,5,7); or
(ii) The number of zeroes in (a+5) or (b-5) has changed (the converse is not implied) (III)
Next, add 9 to (a+5), and deduct 9 from (b-5) .
All other things being equal, there will be no change in the values of SOD(a+14) and SOD(b-14), unless the number of zeroes in one of them has changed (IV)
If so, either:
(i) SOD(a+14) = SOD(b-14), or
(ii) SOD(a+14) = SOD(a+5), and SOD(b-14) = SOD(b-5), in which case either:
(ii)(a) SOD(a+23) = SOD(b-23), or
(ii)(b) The number of zeroes in SOD(a+23) or SOD(b-23) has changed (the converse is not implied).
Obviously this process can be repeated until a solution is found or (b-9k-5)=0
e.g. 797:
k=0, {(a+5), (b-5), SOD(a+5), SOD(b-5)} = {403,394, 7,16} (III)
k=1, {(a+5), (b-5), SOD(a+14), SOD(b-14)}= {412,385,7,16}
k=2, {(a+23), (b-23),SOD(a+23), SOD(b-23} = {421,376,7,16}
k=3, {(a+32), (b-32),SOD(a+32), SOD(b-32} = {430,367,7,16} (IV)
k=4, {(a+41), (b-41),SOD(a+41), SOD(b-41} = {439,358,16,16} (IV(ii)(a))
e.g. 799:
k=0, {(a+5), (b-5), SOD(a+5), SOD(b-5)} ={404,395,8,17} (III)
...
k=41, {(a+41), (b-41), SOD(a+5), SOD(b-5)} ={440,359,8,17} (IV)
but:
k=50, {(a+50), (b-50), SOD(a+50), SOD(b-50)} ={449,350,17,8} (IV(ii)(b))
k=95, {(a+95), (b-95), SOD(a+95), SOD(b-95)} ={494,305,17,8} (IV)
But:
k=104, {(a+104), (b-104), SOD(a+104), SOD(b-104)} ={503,296,8,17} (IV(ii)(b))
... And so on down to (a+9k+5)=799, (b-k-5)=0, with no solutions.
It seems clear enough from the above that with the exception of {1,3,5,7,9} all digits but the first must be a 9, for a number to be 'dark'. Let's assume that the number of 9's is even, e.g. 99, 9999, ... etc., prefixed by no other number;
(98/2+5) = 54, (100/2-5 = 45)
(9998/2+50) = 5049, (10000/2-50 = 4950)
(999998/2+500) = 500499, (1000000/2-500 = 499500)
Generally, SOD (10^(2n)-2)/2+5*10^(n-1) = SOD (10^(2n))/2-5*10^(n-1); if the number of 9's is even, then the number is shiny. (V)
Let's assume that the even string of 9's is prefixed by an even integer: e.g. 299 splits into 149 and 150; 100 is much larger than 5, so the addition of the prefix makes no difference.
Edited on June 22, 2013, 7:12 am
|
Posted by broll
on 2013-06-22 07:10:02 |