I just finished an exam in my math class and I did well except for one question that I just can't get out of my head, it seems simple but I just can't figure it out:
PROBLEM:
s = 1, k = 1, n=4
while k < n {
DO:
a) s = s + k * k
b) k = k + 1
} endWhile
print s
QUESTION: what does this algorithm in general do for values of n?
I think it might have something to do with sum of squares.
Thanks in advance!
Hint: It is adding square numbers to 1 $$s=1 + 1^2 + 2^2 + 3^2$$