Q:

What does the algorithm s = s + k * k do?

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!

A:

For starting values $s_{0},k_{0}$:
$$s(n) = s_{0}+\sum_{k=k_{0}}^{(n-1)} k^2 $$

