Number of times a prime can divide into a number

188 Views Asked by At

If I were to write 40 in binary {101000}, I could tell just from looking at it that 40 is divisible by 2, 3 times.

If I were to write 40 in ternary (base 3) {1111}, I can tell from looking at it that 40 is not divisible by 3.

  • Is there a way to know how many times a number can be divided by a prime, without changing base and without performing an algorithm.

I suspect if there is a way to do it, logarithms will be key.

I know that I can determine the length of a number in a different base. I.e. $\frac{log(40)}{log(2)} = 5.322..$ so 40 in binary is 6 digits long. Not sure if this will be useful though.

  • I'm also wondering if testing divisibility by 2 and 5 may have some rule with the digits because of base 10 being base 2×5.

Thanks in advance

1

There are 1 best solutions below

2
On BEST ANSWER

Logarithms only tell you the maximal power under the limit. For example $p^x \leq n$ leads to $x \leq \log_p(n)$ but it doesn't tell you whether $p$ actually divides $n$ or how many times it does (unless the log calculation turns out to be an integer). It only provides an upper bound on the multiplicity.

Other than that you won't be able to really tell "without an algorithm." You usually just divide $n$ by $p$ over and over again while the modulus is $0$.