Ratio and number theory

The question goes as follows:

Let $K$ be a three digit number such that the ratio of the number to the sum of its digit is least. What is the difference between the hundreds and the tens digits of $K$?

Now I was able to do this question by trial and error, assuming hundredth digit place to be 1 and unit as well as tens digit to be 9

So the number is 199, but I am not able to do it logically, any way to do it?

-
is at least...? Also: brute force is perfectly logical, just inelegant. –  anon Jun 3 '12 at 16:54
that's what I was looking for, an elegant solution, but brute force wont let me prove that yes this is the right answer. –  Kartik Anand Jun 3 '12 at 16:57
@Kartik I feel obliged to point out that this is problem where brute force can definitely prove the right answer. There are only 900 possible $K$s, so it is feasible to check each one to find the minimum. –  Drew Christianson Jun 3 '12 at 17:54
@DrewChristianson checking just 900 possible K's would be good on a computer, but I had this problem in my exam, so you see I wanted to know if something different is possible :) –  Kartik Anand Jun 3 '12 at 18:43
@Kartik. Ah. I didn't know it was an exam problem. Marvis' answer is definitely the better solution then –  Drew Christianson Jun 4 '12 at 0:27

Let the number be $100a + 10 b +c$, where $1 \leq a \leq 9$ and $0 \leq b,c, \leq9$. Hence, we want to minimize $$L=\dfrac{100a + 10b + c}{a+b+c} = 1 + \dfrac{99a+9b}{a+b+c}$$ This means that you should choose $c$ to be maximum as possible since $c$ appears only in the denominator and the term is positive. Hence, $c = 9$. Hence, we want to minimize $$L=\dfrac{100a + 10b + c}{a+b+c} = 1 + \dfrac{99a+9b}{a+b+9} = 1 + \dfrac{90a - 81 + 9a+ 9b + 81}{a+b+9}$$ $$L = 1 + \dfrac{90a-81}{a+b+9} + 9 = 10 + 9 \left(\dfrac{10a-9}{a+b+9} \right)$$ Now again you should choose $b$ to be maximum as possible since $b$ appears only in the denominator and the term is positive. Hence, set $b=9$. Hence, we want to minimize $$L = 10 +9 \left( \dfrac{10a-9}{a+18} \right) = 10 +9 \left( \dfrac{10a + 180 -189}{a+18} \right) = 10 + 90 - \dfrac{9 \times 189}{a+18}$$ Now you ned to choose $a$ to be minimum as possible since $a$ appears in the denominator and the term is negative. Hence, set $a = 1$. Hence, $$L = 100 - \dfrac{9 \times 189}{19} = \dfrac{1900 - 9 \times 189}{19} = \dfrac{199}{19}$$ The number is $199$.

-
seriously thank you :) –  Kartik Anand Jun 3 '12 at 17:28

Doing it in a single function, just for fun:

For $x \in \mathbb{Z}$ we want to minimize the ratio $\frac{100a+10b+c}{a+b+c}$ where $a,b,c\in\mathbb{Z}$ and $100a+10b+c=x$ We can rewrite the ratio as: $$f(x)=\frac{100\left\lfloor\frac{x}{100}\right\rfloor+10\left\lfloor\frac{x-100\left\lfloor\frac{x}{100}\right\rfloor}{10}\right\rfloor+\left\lfloor x-100\left\lfloor\frac{x}{100}\right\rfloor-10\left\lfloor\frac{x-100\left\lfloor\frac{x}{100}\right\rfloor}{10}\right\rfloor\right\rfloor}{\left\lfloor\frac{x}{100}\right\rfloor+\left\lfloor\frac{x-100\left\lfloor\frac{x}{100}\right\rfloor}{10}\right\rfloor+\left\lfloor x-100\left\lfloor\frac{x}{100}\right\rfloor-10\left\lfloor\frac{x-100\left\lfloor\frac{x}{100}\right\rfloor}{10}\right\rfloor\right\rfloor}$$ Which, when graphed, gives: which clearly is minimized at 199 (or 1-9 if the $x$ is allowed to have two leading $0$s)

-
really interesting, loved it ! –  Theorem Jun 3 '12 at 17:42
how did u manage to write it in terms of floor ? –  Theorem Jun 3 '12 at 17:44
With positive division, floor is effectively a truncate function; it returns the integer part of a ratio. Lets take $x=152$ as an example. So let, $d_{100}(152)= \left\lfloor\frac{152}{100}\right\rfloor = \left\lfloor 1.52\right\rfloor = 1$ which is the hundreds digit. Then clearly, $\left\lfloor\frac{152-100*1}{10}\right\rfloor = 5$ is the tens digit, because we've subtracted off the hundreds. Just rephrase the $100*1$ to $100*d_{100}(152)$, and you've got a general expression for the tens digit. Repeat the same process for the 1s digit. –  Drew Christianson Jun 3 '12 at 17:51
The pic is not showing up –  Kartik Anand Jun 3 '12 at 18:46
Your solution is superb indeed, but I wanted something which I could have figured out during my exam :) –  Kartik Anand Jun 3 '12 at 18:52

We want $a>0,b\geq 0,c\geq 0$, $a,b,c\leq 9$ s.t. $r = \frac{(100a+10b+c)}{(a+b+c)}$ is minimum.

$r = 1 + \frac{(99a+9b)}{(a+b+c)}$.

For a given $a$ and $b$, this is least when $c$ is maximum, i.e. $9$.

Now given $c=9, r = 1 + \frac{(99a+9b)}{(a+b+9)} = 1 + 9 + \frac{(90a-9)}{(a+b+9)}$.

Again, we see this is least given $a$ when $b$ is maximum, i.e. $9$.

Now, given $b=c=9$,

$r = 10+\frac{(90a-9)}{(a+18)}$

$\frac{(r-10)}{9}=\frac{(10a-1)}{(a+18)}$

$= \frac{(10a+180-179)}{(a+18)}$

$= 10 - \frac{179}{(a+18)}$.

Clearly, this is least when a has the least possible value, i.e. 1.

-