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?
sumhas after the loops. – Fabio Somenzi Mar 26 '19 at 03:15