f(n+1) = n^2 + f(n)