Why does $\frac{\log(n)}{\log(3)}$ being an integer determine whether $n$ is a power of three?
While doing some programming exercises I came across this problem and the above formula was a proposed solution. Can someone explain to me why this is the case?
Because $n = 3^k$ for some $k \in \mathbb Z$ iff $k = \log_3 n = \frac{\lg n}{\lg 3} \in \mathbb Z$.