[Math] Digits in product of two numbers

decimal-expansionelementary-number-theorynumber theory

When we multiply a $m$ digit number with a $n$ digit number, the product will have either $m+n$ digits or $m+n-1$ digits. I want to get some condition on the numbers so that we can predict about these two cases.

One straight forward condition: If the leftmost digits of the two numbers result in a number greater than $10$ on multiplication, it will fall in the first case.

I am not sure how to move forward.

Best Answer

A positive integer has $n$ digits iff it is $\ge 10^{n-1}$ and $<10^n$, or is of the form $\alpha10^n$ with $0.1\le \alpha<1$. So if the second number id $\beta 10^m$, their product $\alpha\beta10^{n+m}$ will have $n+m$ digits iff $0.1\le \alpha\beta<1$. The $<1$ part always holds as $\alpha,\beta<1$. To decide whether $\alpha\beta\ge1$ or $\alpha\beta<0.1$, it may be sufficient to compute $\alpha\beta$ only with limited precision, i.e., to multiply only a few leading digits of the original integers.

For example, if the first factor begins with $1$, this makes $\alpha<0.2$ and we conclude that $\alpha\beta<0.1$ if $\beta\le0.5$ (i.e., leading digit $\le4$), but cannot make any prediction for leading digits $5$ to $9$: $10\cdot 90$ has three digits, but $19\cdot 59$ has four.

Another example: If you know the leading two digits of the first number are $23$, this tells you $0.23\le\alpha<0.24$. If follows that for $\alpha\beta\ge1$ it is sufficient that $\beta\ge 0.44$ (or that $\beta\ge 434783$, say) and necessary that $\beta> 0.41\overline 6$. So if the other factor has leading digit $1$ to $3$, or the leading digits are $40$ or $41$ followed by less than $6$, etc., then the product has only $n+m-1$ digits. Whereas if the leading digit is $5$ or more, or the leading digits are a $4$ followed by $4$ or more, or ..., then the product has $n+m$ digits. In the cases not covered, we simply need more information (in particular, more digits of the first number).

Related Question