My problem with this is the final step. Through iterative substitution, I come up with the following: $$T(n) = T(n-4) + (n-3) + (n-2) + (n-1) + n$$
which leads to the general form: $$T(n) = T(n-k) + kn - \frac{[k(k-1)]}{2}$$
The restrictions are $T(1)=1$ and $n=2^k-1$. What I am doing at this point is solving for $k$, when $T(1) = 1$ which gives me : $$n = 2^k - 1$$ $$n + 1 = 2^k$$ $$2 = 2^k$$ ($n=1$, since this is for $T(1)=1$)
$$1 = k$$
plugging back in I just come up with the original formula which is obviously not correct.
What am I doing wrong in the final step (if that really is my problem)? Based on other examples I have seen, this would work out nicely if I can put $k$ in terms of $n$ instead of a constant, but I am drawing a blank on how to do this and I cannot find it anywhere.
Alternatively, one may use a telescoping sum. From $$ T(k)-T(k-1)=k, \qquad k=1,2,3,\cdots, \tag1 $$ one gets $$ \sum_{k=1}^n \left(T(k)-T(k-1)\right)=T(n)-T(0)=\sum_{k=1}^n k, \qquad n\ge1, $$ giving