Why in the code i ≃ n?
The symbol $\space ≃ \space$ means "asymptotically equal to". 

So when you read $ n ≃ i$, you can read it as $n$ asymptotically approaches $i$.

This means that the more $n$ increase in size, the more $i$ increase in size but $n$ never become equal to $i$.


  I mean suppose $n=1000$ and so $i=2,4,16,32,256,65536$ is in every steps.


This contains an error: when the program start $i=2$. At the first cicle, $i=2^2 = 4 $. $\space$ At the second cicle, $i=4^2=16$. $\space$ At the third cicle, $i = 16^2= 256$. $\space$ At the fourth cycle, $i=256^2 = 65536$. $\space$ At the fifth cycle the program stops since $i&gt;n$.