title: Trouble analyzing complexity of arbitrary algorithm
body: <p>I've been reading the CLRS algorithm book and I decided to try out a problem for myself. I've been trying to use a new method to help understand the complexity of the arbitrary algorithm, displayed below. Here is my method:</p>
  
  <p><strong>Line-by-line Analysis:</strong></p>
  
  <p><code>Line 2. Sum of natural numbers.</code> Theta (N)</p>
  
  <p><code>Line 3. Sum of squares.</code> Theta (N<sup>2</sup>)</p>
  
  <p><code>Line 4. If j is divisible by i.</code> Theta (<strong>?</strong>)</p>
  
  <p><code>Line 5. Sum of natural numbers.</code> Theta (N)</p>
  
  <p><strong>Algorithm</strong>:</p>
  
  <pre><code>1. sum = 0
  2. for i=1 to n do
  3.    for j=1 to i<sup>2</sup> do
  4.       if(j(mod i) == 0) then
  5.          for k=1 to j do
  6.             sum++</code></pre>
  
  <p>As you can tell, I'm trying to find the number of times <code>sum++</code> is executed, and it's <strong>Line 4</strong> that is throwing me off. Could someone guide me a little bit?</p>