title: Finding Step Count Function with Ceiling/Floor Functions
body: <p>I came across a challenge problem in a textbook that I am having trouble with. I need to find the step-count function in terms of n which counts the number of times the print procedure is called. Below is the pseudocode.</p>
  
  <pre><code>function EXAMPLE( some positive int n )
   i &lt;- 1
   while i &lt;= n do
        i &lt;- i * 2
        j &lt;- 1
        while j &lt;= i do
            j &lt;- j + 1
            print("something")
  </code></pre>
  
  <p>I tried starting with finding the number of times print is called with respect to n for a few cases:</p>
  
  <pre><code>n  T(n)
  1   2
  2   6
  3   6
  4   14
  5   14
  </code></pre>
  
  <p>I'm sure that a ceiling/floor function with n is involved somehow for the first while loop, but am unsure as to how to proceed from there. Any help is appreciated.</p>