- #1
playboy
Homework Statement
So I was giving a problem to "calculate" the number of flops in class today..
Now, I read the examples in the textbook, and they are hard enough to understand...I am hoping that some one here can push me onto the right track
Homework Equations
find the flop count for the following sequence of commands:
a=0;
..for p=1:n
...for q=p:n
...for r=q:n
...a=a+1;
...end
...end
..end
What will be the value of a after the commands are executed ?
The Attempt at a Solution
I am not looking for a number, but a summation formula interms of n.
I am given that it has to be in the form
sum(i,n) i = n(1-n)/2
and
sum(i,n) i^2 = n(1-n)(2n-a)/6
So far, all I can see is that their must be n + n + n = 3n flops...
I have no idea how to calculate a.
Can somebody help me please?