Run time for a specific loop confusion
A basic result in elementary arithmetic states that
$$
\log_a n = \log_a b \cdot \log_b n.
$$
Indeed, on the one hand, $a^{\log_a n}$ by definition. On the other hand,
$$
a^{\log_a b \cdot \log_b n} = (a^{\log_a b})^{\log_b n} = b^{\log_b n} = n.
$$
Similarly,
$$
\log_b n = \log_b a \cdot \log_a n.
$$
This shows that every two logarithms only differ by a constant multiple. Since big O notation discounts constant factors, it doesn't matter which logarithm you use (unless it's in the exponent). For example, a function is $O(\log_a n)$ iff it is $O(\log_b n)$. For this reason we usually don't bother writing the basis of a logarithm in big O notation.