Number of iterations of a while loop

I need to find out number of iterations this while loop will perform before terminating.

I have calculated log(1000/n) and complexity is logb(n), is it correct?

while n <100,000
n←n×b
endwhile
• What is the initial value of $n$ before the start of the loop? Is it $1$? – John Omielan Feb 11 at 1:43
• Yeah you can consider that – June Feb 11 at 1:48
• Since the value of $n$ changes during the loop, it doesn't make sense for it to show up in the formula for the complexity of the entire loop. It might make sense for the starting value of $n$ to be in the formula if the loop is allowed to start from different initial values, but you would have to give that number its own name. – David K Feb 11 at 2:28
• By the way, a step-by-step explanation of your reasoning could help. To fix the math notation, start here: math.stackexchange.com/help/notation – David K Feb 11 at 2:47

You need to play a bit and see what values does $$n$$ takes?
$$n = 1 [=b^0]$$ $$n = b [=b^1]$$ $$n = b^2$$ $$\vdots$$ $$n = b^k [= 100, 000]$$
So $$k = \log_b 100,000 = O(1)$$ for reasonable $$b$$ (i.e. $$b > 1$$).