I am trying to convert instances of nested 'for' loops into a summation expression. The current code fragment I have is:
for i = 1 to n:
for j = 1 to n:
if (i*j >= n):
for k = 1 to n:
sum++
endif
Basically, the 'if' conditional is confusing me. I know that the loops prior will be called n^2 times, but the third loop is only called when $i*j >= n$. How would I write the third summation to account for this, and then evaluate the overall loop's time complexity?
Hint:
The "for" cycle in $k$ is very easy to turn into something simpler...
As for the other parts, see if you can split the problem into easier steps. For example, what happens for $i=1$? And what happens for $i=2$? And $i=3$? And...