Formula for working out the greatest power that another number is divisible by

33 Views Asked by At

Is there a formula to answer the question

What is the highest value of $n$ where it is true that $b^n$ is a factor of $x$?

where $b$ and $x$ are known positive integers and $n$ is an unknown non-negative integer?

Visually, it's the same as asking

How many zeros are at the end of $x_b$?

There are $n$ zeros at the end of $x$ represented in base $b$. What is the value of $n$?

So, where $x$ is 45000 and $b$ is 10, $n$ is 3 because 45000 is divisible by $10^3$ but not by $10^4$. This is easy to solve as an iterative computer program but I don't know how it would be solved mathematically.

Is there a formal mathematical way of writing (and solving) this problem?