[Math] How many times can I divide a number by another

divisibility

How many times can I divide a number by another until I get a fractional number.

For e.g. I can divide 100 by 2 two times before I get a fractional number i.e. 12.5. Is there any formula that given a number N and another number x I can get the no. of times x will divide N before we get a fractional number.

EDIT :- It is given that x is a prime number and comes at least once in the prime factorization of N. We are also given all the prime factors of N but not their powers.

EDIT :- I think the only solution will be to repeatedly divide the N by x and check if it is fractional or not as told by Arthur

Best Answer

There isn't a formula, per se, since this depends entirely on the prime factorisations of $N$ and $x$, and we don't have a good way to get those.

That being said, if we have the prime factorisations: $$ N = 2^{N_2}\cdot3^{N_3}\cdot5^{N_5}\cdots\\ x = 2^{x_2}\cdot3^{x_3}\cdot5^{x_5}\cdots $$ (where most of the exponents $N_p$ and $x_p$ are $0$), then you can divide $N$ by $x$ the following number of times, without getting decimals: $$ \min\left\{\left\lfloor\left.\frac{N_i}{x_i}\right\rfloor\,\,\right|\,\,x_i\neq 0\right\} $$ In other words, take all the exponents $x_i$ which aren't $0$, divide the corresponding $N_i$ by those $x_i$, take away the decimal part, so you're only left with integers, then take the smallest of those integers.

For instance, $100 = 2^2\cdot 5^2$ and $2 = 2^1$. So we take all the exponents of the latter (which is $1$), take the corresponding exponents from the former (which is $2$), calculate $\frac21 = 2$, strip away the decimals, and we see that we may divide $100$ by $2$ two times without getting decimals.

For a more involved example, where it's easier to see which part corresponds to what, let's look at dividing $360 = 2^3\cdot 3^2\cdot 5^1$ by $12 = 2^2\cdot 3^1$. The non-zero exponents of $12$ are $2$ and $1$ (with bases $2$ and $3$, repsectively). The corresponding exponents of $360$ are $3$ and $2$, respectively.

So, we calculate $\frac32 = 1.5$ and $\frac21 = 2$, strip away all decimals to get $1$ and $2$, take the smallest one of these (which is $1$), and we see that we can divide $360$ by $12$ once without getting decimals (we get $30$), but not twice (we would get $2.5$).

Responding to the edit: If we know that $x$ is prime, then that makes the above a lot easier: only one of the exponents of $x$ is non-zero (namely $x_x$), and that is equal to $1$, so the answer is actually just $N_x$. However, if we don't have $N_x$, then really, the easiest (and as far as I know only) way to get it is to divide by $x$ repeatedly and check.