Let S ( N ) denote the digit sum of the integer N . As N ranges over all 3-digit positive numbers, what value of N would give the minimum of M = S ( N ) N ?
Details and assumptions
The number 1 2 = 0 1 2 is a 2-digit number, not a 3-digit number.
The digit sum of a number is the sum of all its digits. For example the digit sum of 1123 is 1 + 1 + 2 + 3 = 7 .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
I think you made a small mistake... when you write (99A+9B)/(A+B+9) +1 = (90A-81)(9A+9B+81)/(A+B+9), I think you mean that it equals [(90A-81)+(9A+9B+81)]/(A+B+9)
Nice solution bro! I forgot that the numbers could repeat and i answered 189 in my third attempt. :-(
A 3 digit number where the digits are a,b & c has a value N=100a+10b+c and a digit sum a+b+c. The problem is to minimise M ( N ) = a + b + c 1 0 0 a + 1 0 b + c . We are also told it must be a three digit number so 1 ≤ a ≤ 9 and 0 ≤ b ≤ 9 , 0 ≤ c ≤ 9 . It is reasonably intuitive to see at this point that a should be as small as possible and c as large as possible. More rigorously one can look at the partial derivatives to see the slope of the function M(N) for the digits a,b & c.
∂ a ∂ M ( N ) = a + b + c 1 0 0 − ( a + b + c ) 2 1 0 0 a + 1 0 b + c ∂ b ∂ M ( N ) = a + b + c 1 0 − ( a + b + c ) 2 1 0 0 a + 1 0 b + c ∂ c ∂ M ( N ) = a + b + c 1 − ( a + b + c ) 2 1 0 0 a + 1 0 b + c
This confirms the intuition as ∂ a ∂ M ( N ) > 0 and ∂ b ∂ M ( N ) < 0 and ∂ c ∂ M ( N ) < 0 for all allowed values.
Hence a=1, b=9, c=9 and N=199 is the solution.
Let N = 1 0 0 x + 1 0 y + z , and hence S ( N ) = x + y + z .
Thus M = x + y + z 1 0 0 x + 1 0 y + z = x + y + z 9 9 x + 9 y + 1
Since 1 is a constant, M is minimized when x + y + z 9 9 x + 9 y is minimal.
Since z only appears in the denominator, x + y + z 9 9 x + 9 y is minimized when z is maximized which in this case is 9.
Substituting 9 for z obtains x + y + 9 9 9 x + 9 y = 9 ( x + y + 9 1 1 x + y ) .
Once again since the 9 is a constant, we can not worry about it.
x + y + 9 1 1 x + y
Testing values of x, we clearly see that the fraction above is minimized when x = 1 .
x = 1 , 1 0 + y 1 1 + y ; x = 2 , 1 1 + y 2 2 + y ; x = 3 , 1 2 + y 3 3 + y
Substituting in x=1, 1 0 + y 1 1 + y = 1 + 1 0 + y 1 .
Clearly, 1 0 + y 1 is minimized when y is maximized, hence y = 9.
Therefore M is minimal when N = 1 9 9 .
We are minimizing (100a + 10b + c) / (a + b + c). Think of this as computing the average of a copies of 100, b copies of 10, and c copies of 1. Clearly such an average will be between 1 and 100, so every time we increase c by 1, or decrease a by 1 the average goes down. Consequently for the optimal solution, c must be as large as possible and a must be as small as possible: c = 9 and a = 1. This gives an average (not counting b yet) of 109/10 = 10.9. Since this quantity is greater than 10, every increase in b will lower the average further, so the optimal solution must have b = 9.
Let number be 100a+10b+c
Then N1
N/s(n)= (100a+10b+c)/a+b+c
Now taking the number N2 as 100+10b+(c+1) where
And evaluating n/s(n) for this number and comparing this fraction with previous one we get
(100a+10b+c)/(a+b+c) , (100a+10b+c+1)/(a+b+c+1)
As here numerator and denominator both are +ve so we can cross multiply without changing the inequality
So we get (100a+10b+c)>(a+b+c)
So this ratio is greater for the fraction with unit digit greatest hence c=9
Solving for b simillarly we have to compare
(100a+10b+c)/(a+b+c) and (100a+10(b+1)+c)/(a+(b+1)+c)
Again cross multiplying we get
(100a+10b+c)and 10
(a+b+c)
90a-9c>0 so
So to make this fraction minimum we should maximize b also
Hence b=9
Now for a
We have to compare fractions as
(100a+10b+c)/(a+b+c) and (100(a+1)+10b+c)/((a+1)+b+c)
Again cross multiplying we get
100a+10b+c<100
(a+b+c)
0<90b+99c
So by increasing the hundred place digit by one we get the ratio to be greater than the previous one
So we should make a minimum thus a=1
And ans is 199
Let N = a b c = 1 0 0 a + 1 0 b + c where 1 ≤ a ≤ 9 , 0 ≤ b ≤ 9 and 0 ≤ c ≤ 9 .
We have a + b + c a b c = a + b + c 1 0 0 a + 1 0 b + c = a + b + c 9 9 a + 9 b + 1 . Thus, the minimal occurs when c = 9 .
Substituting c = 9 , we have a + b + 9 9 9 a + 9 b + 1 = a + b + 9 9 0 a − 8 1 + 9 + 1 . Thus, the minimal occurs when b = 9 .
By considering the graph of the rational function a + 1 8 9 0 a − 8 1 , it is increasing on [ 1 , ∞ ) , thus the minimal occurs when a = 1 .
Therefore N = a b c = 1 9 9 gives the minimal value of M which is 9 9 1 9 9 .
Good solution! I think you made a typo at the last line, shouldn't it be 1 9 1 9 9 .
Notice that from a 0 0 to a 9 9 , a 9 9 gives the minimum value of M . So checking 1 9 9 to 9 9 9 yields 1 9 9 gives the minimum value.
199. First select lowest 3 digit number 100. Divide it by its S(n) which will give a 100(Which is certainly not a minimum). Then select largest 3 digit number 999. Divide it by its S(n) which will give a 37 approx. then check for 899. you'll see that it becomes even lesser then it is clear that lowest will be that for 199(M about 10!). Answer is 199.
Letting our three digit number d e f be such that d e f = 1 0 0 a + 1 0 b + c , we see that M = a + b + c 1 0 0 a + 1 0 b + c .
The batting average lemma states that if b a ≤ d c then c + d a + b ≤ d c .
So now we start with n = 1 0 0 and consider what happens if we add, batting average style, to each digits place: we add a fraction of value corresponding to the value of the place.
So, and this is not fully rigorous but it does suffice after a little numerical testing at the extreme ranges to see if the pattern holds, we see that increasing b and c decreases the value of M but that increasing a does not. So we let b and c be 9 and a be 1 and our answer is that the minimum value of M occurs at n = 1 9 9
if we want M to be minimum the we should consider N as minimum and S(N) as maximum if we want N to be minimum we should consider it as little more than a hundred but less than 200 but we should also keep in mind that S(N) should be maximum so in the integer N we should have 9 and 1 and the most reasonable answer for this is 199.
To get the minimum value of M which is equal to N/S(N), you should minimize the numerator N and maximize the denominator S(N).
Since we are dealing with 3-digit number, the minimum value of denominator is 100 and maximum value of denominator is 27 (from 3-digit no., 999 or 9+9+9=27).
Trying to get M for the max numerator, 100/1 = 100 trying to get M for the min denominator, 999/27 = 37
We can analyze from above, to get min M, we have to get a smaller value of N but with high sum of its digits. So we can say, that in the number we are looking for, it has atleast one digit 9 in it. But to make it smaller, we should put the 9 on the ones digit.
So we have, 109. Trying to get M, 109/10 = 10.9 so less than 37 Considering 2 9's but making it relatively small, we will have 199. Trying to get M, 199/19 = 10.47 < 10.9
So how we will be able to know if it is the minimum?
Let N = 100a + 10b + c S(N) = a + b + c
Considering a smaller M as equal to 10.
so 10 = (100a + 10b + c)/(a + b + c)
Simplifying, we will have 10a = c, where b is cancelled.
so it means, to have M equal to 10, the ones digit should be 10 times the hundredths digit, which is impossible. So, we consider 9 instead as the highest unit digit number. Thus, a should be 1 and c should be 9. So, we could have M as 1b9. Since b was cancelled from the equation, any value of b will still produce 10.something of M. Thus, to get the smallest value of M, we have to maximize b which is 9.
Thus the minimum value of M is 199
Let's start with the least 3-digit number. N=100, S(N)=1, N/S(N)= 100
Next, with the largest 3-digit number. N=999, S(N)=27, N/S(N)= 37
By doing these, you can deduce that the biggest denominator you can have is 27 only. Since you want to minimize N/S(N), you want the denominator to be largest and numerator to be the least.
As much as possible, you want to use the digit 9 in your N to get a high denominator. We can put the digits 9 in the ones and tens place. We want the least number in the hundreds place to have least N/S(N). Therefore N=199.
package brilliant;
public class Brilliant {
public static void main (String[] args) {
double min = 999;
double M = 0;
int N = 0;
for (int i = 100; i <= 999; i++) {
M = (double) i / sumDigits (i);
if (M < min) {
min = M;
N = i;
}
}
System.out.println ("N = " + N);
}
public static int sumDigits (int n) {
if (n >= 10) {
return n % 10 + sumDigits (n / 10);
}
else {
return n;
}
}
}
Here, the numerator (N) of the fraction should be minimum and denominator (S(N)) should be maximum. Hence, the numerator must be in 100's and denominator should be an addition of the digits of max. magnitude (i.e, 9).
Summing up, we get, Numerator can be 109, 119,... and Denominator can be (1+0+9), (1+1+9),... respectively. By trial and error, 109/(1+0+9)= 10.9; 119/(1+1+9)= 10.81 ; and so on....
Hence, observing the pattern we see that as we increase the numerator by 10, the fraction keeps decreasing. Hence at 199/(1+9+9)= 10.47 , the fraction should be minimum.
For further verifying it, we take 299/(2+9+9)= 14.95 ; 399/(3+9+9)= 19 ; and so the value of the fraction keeps increasing as we increase the numerator. Hence, we conclude that the fraction "M" has minimum value when N=199.
Firstly, to simplify matters, let us assume that N/S(N)=z. Let us also express N as 100a+10b+c. We are able to write 100a+10b+c=(a+b+c)*z -----(1)
Here we need a key observation, that z >10. We will prove this by contradiction. Let us assume z=10. Then we can write 100a+10b+c=10a+10b+10c <=> 90a=9c <=> 10a=c. Since 10 is a two digit number and c is a single digit number, for a>0, no solution for c is possible.
Therefore we can write z as (z-10)+10 since the 10 cancels out. we substitute it back into (1), we get 100a+10b+c=(a+b+c)((z-10)+10) Expanding and rearranging, we get 9(10a-c)/(a+b+c)=z-10 ----------(2)
If we can minimise z-10, then 10+(z-10) will also be minimised since 10 is a constant. In order to minimise z-10, we want to maximise the denominator and minimise the numerator of the fraction in the left hand side of equation (2).
First, we look at the denominator and see how we can maximise it.We observe that b is present only in the denominator which makes it a constant so we can maximise it. Therefore, we see that b=9.
Next, we want to minimise the denominator, in other words, we want to maximise c but minimise a. However, note that the a is a positive integer, i.e. a>0.Therefore, we let c=9 and a=1.
Summarising the above steps, we first wrote a fraction concerning 10-z and we would want to minimise it. Then we used analysis and showed that a=1,b=9 and c=9. Therefore, the answer to the above question is 199.
As per question, we require to maximize S(N) & minimize N. Also note with decrease in numerator the S ( N ) N decreases abruptly while with decrease in denominator, it increases (keeping other constant)... A large S(N) is obtained when N has large digits,while we need N to be small as well,so we include 9 s one by one, to maximize digit sum,but with 9 s the N increases as well, so for hundred's digit,we take 1. We get the fraction to 10.47. Let's now test against this value.
Clearly, if we increase hundred's digit...the number increases many fold,& fraction for 299 is 14.95. So we need not test further values.
All remains is to test if ten's digit is decreased, then fraction increases slightly as denominator decreases by 1,but numerator by 10. We have for 189 the fraction is 10.5. Hence,we need not test further values & we are done...
Problem Loading...
Note Loading...
Set Loading...
This is a 3-digit number, so we can call the digits A B C, where A = 0 . This means: N = 1 0 0 A + 1 0 B + C and S = A + B + C . So, by the definition of M , we have: M = A + B + C 1 0 0 A + 1 0 B + C
Remark that this can be re-written as M = A + B + C 9 9 A + 9 B + 1 . Consider this as a function of C and notice that C only appears in the denominator. We want to minimize this, so we want to maximize C; i.e. C = 9 . [Note: It doesn't matter what positive values A and B are. - Calvin]
Substituting this into the equation above, we obtain: M = A + B + 9 9 9 A + 9 B + 1 = A + B + 9 ( 9 0 A − 8 1 ) ( 9 A + 9 B + 8 1 ) + 1 . Now, M can be rewritten as M = A + B + 9 9 0 A − 8 1 + 9 + 1 = A + B + 9 9 0 A − 8 1 + 1 0 . Again, we wish to minimize this so, in the same manner, we note that B only appears in the denominator in this function of B. Clearly, we want to maximize B to minimize this fraction. So, B = 9 .
Substituting B = 9 into this, we get: M = A + 1 8 9 0 A − 8 1 + 1 0 . Now, haste makes waste! We cannot just conclude that A = 9 as well. In fact, it's quite clear that 999 isn't the best we can do. Note that M = A + 1 8 9 0 A − 8 1 + 1 0 = A + 1 8 9 0 A + 9 0 × 1 8 − 9 0 × 1 8 − 8 1 + 1 0 = 9 0 − A + 1 8 9 0 × 1 8 + 8 1 + 1 0 . Aha! We want to minimize this expression, so we want to maximize A + 1 8 1 . And, to do this, we need to minimize A, since A is in the denominator. This is reverse logic from what we did with B and C. Since A can't be 0 (if it was, we wouldn't have a 3-digit number), A must be 1.
So, we got: A = 1, B = 9, C = 9, so the answer is 1 9 9 .