Find the time complexity of the given code

72 Views Asked by At

Although this is a computer science question,still i am posting it here because it needs loads of mathematics in it.

Question

Find the time complexity of the given code-:

While(n>2)
{ 
  n=n/log(2,n);
}

My Approach

The series of the code can be written as-:

$$S=\frac{n}{\log_{2}n}+\frac{n}{\log_{2}^{2}n}+\frac{n}{\log_{2}^{3}n}+...\frac{n}{\log_{2}^{k}n}$$ $$=n(\frac{1}{\log_{2}n}+\frac{1}{\log_{2}^{2}n}+\frac{1}{\log_{2}^{3}n}+...\frac{1}{\log_{2}^{k}n})$$

now i have to solve

$$ \sum_{i=1}^{i=k}\log_2 ^{i}n $$


totally stucked to move forward.please help.


[EDIT] i need to find $k$,

$$\frac{n}{\log_{2}^{k}n}=2$$

$$\frac{n}{\log_{2}^{k}n}=2$$