The product of digits of a two digit number n is m . Find n if m+n=118.
$$ n=a10+b\\ a\times b=m\\ m+n=118\\ m=118-n\\ a\times b=118-n\\ b=\cfrac{118-n}{a}\\ a=\cfrac{n-b}{10}\\ b=\cfrac{10(118-n)}{n-b}\\ nb-b^2=10(118-n)\\ b^2-nb+10(118-n)=0\\ $$ b can be solved using the quadratic formula in terms of n, from which a can be solved in terms of n. This can then be used with the following to find n: $$ a\times b=118-n\\ $$
There are 16 solutions. We have 3 equations but 4 unknowns: http://www.wolframalpha.com/input/?i=n%3Da*10%2Bb%2Ca*b%3Dm%2Cm%2Bn%3D118
Another way to solve this is: \[n=10a+b \rightarrow m=ab \rightarrow m+n=10a+b+ab=10a+b(a+1)=118\] Now a is a number from 1...9 and b is from 0..9 - since n is given to be a 2 digit number Notice that if a=5 then the maximum value of \[10a+b(a+1)\] can be 10*5+9*6=104. So we know that a has to be 6...9. By simple trial and error we can find: a=7 and b=6 thus giving n=76 Checking out: 7*6+76=42+76=118 Here, using the fact that 1<=a<=9 and 0<=b<=9 makes all the difference and avoids the use of quadratics and the like.
Thanks! @ybarrap @RajeshRathod
yw - note that a and b can either be both negative or both positive since the sign of n was not given.
Join our real-time social learning platform and learn together with your friends!