I think reasoning in the opposite way could be more intuitive:
You start from a certain n₀
, that is the lowest positive number recognized, and at each step (i.e., for each unit of time t
) you multiply it by 2 until, at a certain time t*
, you reach a certain n*
, that in your question corresponds to the original value of n
.
The value of n*
will be:
n₀*2*2*2*2*2*...*2*2*2*2*2
|___number of steps___|
i.e., n* = n₀*2^(t*)
. In general, we have that n = n₀*2^t
and, reasoning asymptotically, since n₀
is a constant factor, we have that n∈O(2^t)
.
Thus, doing a re-inversion, we have that the time complexity is logarithmic w.r.t. n
(indeed, it is O(log₂(n))
).