title: O(n log log n) time complexity
body: <p>I have a short program here:</p>
  
  <pre><code>Given any n:
  i = 0;
  while (i &lt; n) {
     k = 2;
     while (k &lt; n) {
          sum += a[j] * b[k]
          k = k * k;
     }
     i++;
  }
  </code></pre>
  
  <p>The asymptotic running time of this is O(n log log n). Why is this the case? I get that the entire program will at least run n times. But I'm not sure how to find log log n. The inner loop is depending on k * k, so it's obviously going to be less than n. And it would just be n log n if it was k / 2 each time. But how would you figure out the answer to be log log n?</p>