# Smallest n digit number that can divide a n digit number

Is there any simple way to find the smallest n digit number that can divide n digit number.

For Example: Lets take a two digit number xx. I want to find the smallest two digit(yy) number that can divide the number xx.

And if its three digit xxx then i need to find smallest three digit yyy.

• I guess the question is: Is $\overbrace{11\cdots 1}^\text { n digits}$ the smallest $n$-digit divisor of $\overbrace{99\cdots 9}^\text { n digits}$? – Maesumi Jul 11 '13 at 10:03
• On second thought the problem is asking given $n$ and $m$, how to find the smallest divisor of $n$ larger than $m$. – Maesumi Jul 11 '13 at 10:09
• @Maesumi This is clear, because any smaller divisor would have to be smaller than $99...9/10$ and would have at most $n-1$ digits – Cocopuffs Jul 11 '13 at 10:09
• @Maesumi: Sorry I haven't written the question properly. I have made an edit. Hope it helps – karthick Jul 11 '13 at 10:21

If $N$ is an $n$ digit number and $d$ is another $n$ digit number dividing $N$, then $1\le N/d\le 9$. So you divide succesively by $9$, $8$, ..., $1$ until an exact division occurs. In your example $99/9=11$, so $11$ is the solution. If $N$ is prime (and $n\ge2$), then it is not divisible by $2,3,\dots,9$, so that the smallest $n$ digit number dividing $N$ is $N$ itself.
• Even if $N$ is not prime, the answer may be $N$ itself, e.g., $N=12$, or $N=49$. – Gerry Myerson Jul 11 '13 at 10:13