title: Expressing pseudo code as a function of n
body: <p>I want to express what this pseudo code returns as a function.</p>
  
  <pre><code>function mystery(n)
      r := 0
      for i:= 1 to n-1 do
          for j:= i+1 to n do
              for k:= 1 to j do
                  r:= r+1
      return r
  </code></pre>
  
  <p>I believe it may be something along the lines of f(n) = n*(n-1)^2
  but I don't think that's quite right. Can some one explain if this is correct and if false then how should I go about arriving to a proper answer.</p>