int sumHelper(int n, int a) {
if (n==0) return a;
else return sumHelper(n-1, a + n*n);
}
int sumSqr(int n) {
return sumHelper(n, 0);
}
I am supposed to prove this piece of code which uses tail recursion to sum up the squares of numbers. That is, I need to prove that for $n ≥ 1$, $sumsqr(n)=1^2+2^2+\dots+n^2$. I have figured out the base case but I am stuck at the induction step. Any hints or help will be appreciated.