For the following algorithm find the number of times the assignment statement (:=) is executed during the running of the program. Answer the question by giving a formula in terms of n:
i := 1;
while i < n + 1 do
i := i + 2;
for j := 1 to i do S od
Assume the number of times is m.
From i:=1 we can get the number of time for this part is 1;
From i:=i+2 we ...
The solution finds the number of times the assignment statement is executed during the running of the program.