0
$\begingroup$

What is the biggest number below or equal to N that you can get by multiply two other number of K and L digits?

According to this post [a post from Quora], if you have two number of K and L digit, the product of this two number will have (K+L) or (K+L-1) digit.

So, if for example I have N=75148 (5 digits), what are the lowest and biggest number below 75148 that I can get by multiplying two numbers for example of 2 digit and 3 digit?

And so in general, my question is: given a whole number N, and given two other whole number K and L, what are the biggest and lowest whole number below or equal to N that you can get by multiplying a number of K digits with a number of L digits?

Input: N, K, L  

Output 1: T,p,q 
where T=p*q  
and p is a number of K digits 
and q is a number of L digits 
and T <= N
and T is the biggest possible number such that T <= N

Output 2: U,f,g
where U=f*g
and f is a number of K digits
and g is a number of L digits
and U <= N
and U is the smallest possible number such that U <= N

All of this are whole numbers

$\endgroup$
  • $\begingroup$ What do you mean by numbers here? Whole numbers? $\endgroup$ – N8tron Jun 12 '18 at 0:13
  • 1
    $\begingroup$ Yes, exactly. Just edited the question. Thank you $\endgroup$ – user2548436 Jun 12 '18 at 0:18
  • $\begingroup$ the smallest whole number that is the product of a n digit whole number and an m digit whole number is $10^{n+m}$. No guarantee this is less than N, so there may be no answer (to either). $\endgroup$ – N8tron Jun 12 '18 at 0:25
  • $\begingroup$ The biggest possible product of a 2 digit and 3 digit is $81(11)(111)$ and N bigger than this will simply return that value. Something similar happens for m and n digits. So the interesting case is for N bigger than the smallest possible value and less than the largest possible value. $\endgroup$ – N8tron Jun 12 '18 at 0:36
  • $\begingroup$ The biggest possible product of $2$ digits times $3$ digits is $99\cdot 999=98901$ $\endgroup$ – Ross Millikan Jun 12 '18 at 0:52
1
$\begingroup$

The smallest number you can get multiplying $2$ digits by $3$ digits is $10 \cdot 100=1000$

To get the largest number less than $75148$ all I can think of is to count downward and check. We can factor $75147=3\cdot 37 \cdot 677$ and observe that there is not way to split up the factors to get $2$ times $3$ digits. $75146=2\cdot 37573$ doesn't work, either, but $75145=5\cdot 7 \cdot 19 \cdot 113=95 \cdot 791$ does and we are done.

What you need is to have the two digit number larger than the leading two digits of the product, so you want the largest number less than $75148$ that has a factor in the range $[76,99]$. If there aren't any greater than or equal to $75000$ you can expand the factor range to $[75,99]$ This would suggest an algorithm. Loop downward from the starting number, then loop over the large two digit numbers and check divisibility.

$\endgroup$
  • $\begingroup$ I've just edited my question to be more clear, thank you $\endgroup$ – user2548436 Jun 12 '18 at 0:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.