How to check if a number can be expressed as a power of another number?
A positive integer \(a\) can be expressed as a power of another positive integer \(b\), if
\[\begin{equation} \boxed{ log_{b} a = \frac{\ln a}{\ln b} = \text{An integer}}. \end{equation}\]For example, since,
\[\begin{equation} \log_{8} 4098 = \frac{\ln 4098}{\ln 8} = 4.0002 \end{equation}\]is not an integer, 4098 can not be expressed as a power of 8. However, 4096 can be expressed as a power of 8 as
\[\begin{equation} \log_{8} 4096 = \frac{\ln 4096}{\ln 8} = 4. \end{equation}\]There is one more way to check if a given number can be expressed as power of another number.
A positive integer \(a\) can be expressed as the power of another positive integer \(b\), if,
- \(a\) is devisible by \(b\) and
- \(\frac{a}{b}\) is a power of \(b\).
These conditions appear to be very simple, but the calculations get really messy because the conditions have to be applied recursievely. This method is best suited for a computer program. Lagarthmic method is best suited for quick calculations.