Originally Posted by
lemon14
I didn't quite catch where you got the expressions from when n is odd / even.
Assuming you followed my convoluted logic up to the point of
(a+1)
2 + a
1
(4a+2)
4 + (4a+1)
3
(16a+6)
6 + (16a+5)
5
(64a+22)
8 + (64a+21)
7
...
I just sort of empirically wrote down the formula, but I think I can explain it:
First, in the case that n is odd, this procedure will ultimately boil down to coefficients of
and
, both of which equal 1. Likewise,
a=1 as well.
So in the odd case, the answer for
will be the sum of the left- and right-hand coefficients (without the
a's). For example, if n=9, my expansion above goes to completion (there's nothing else after the... ).
The coefficient in front of the
a is
on the first line, then
on the second line,
on the third, and
on the last line. Notice also that each subsequent line corresponds to an expansion by two more orders of
n. In other words, the left-hand coefficient on the first line corresponds to
(a.k.a.
2), then
4 on the next line, then
6, then finally
8. That's as far as we need to go because
which is where we stop.
Since we decrease the order by two on each subsequent line, the total number of lines goes like n/2. To be exact, it's actually (n-1)/2, since we start at n and end at 1.
As for the power-of-4 term in front of the
a's, the power goes up with the number of lines. But the exponent starts at 0, not 1, so the final coefficient ends up being
. Since, for the odd case, there are two of these terms which add together (one from the left-hand side and one from the right), we finally end up with
.
Meanwhile, for the "constant" term on the right-hand side of each line, you can see that it's simply a sum of powers of 4, starting on the
second line. The term is
on line 2, then
on line 3, then
on line 4. Now, since the coefficients don't start adding up until line 2, there are only (n-3)/2 of them. Plus, given the fact that the first term is to the 0 power, not 1, that means that the highest power on the last line is (n-3)/2 - 1 = (n-5)/2. Thus the constant term on the right-hand side is
. The constant from the left-hand side is exactly the same, plus 1. Hence for the odd-n case, the total of the constant terms is
.
For the n-is-even case the logic is pretty similar. The big difference there is that the left-hand term vanishes when we're done because we're down to
for that side. Hence only the right-hand side matters.
Given that, the coefficient of the
a term is slightly different. Now we're going from order
n to 0 by 2 each time, so there are a total of n/2 lines (instead of (n-1)/2 like in the odd case). It still starts with
, so the power of 4 on the last line will be one less than the number of lines:
. Meanwhile, the summation term follows the same logic as before except that again there are now n/2 lines, rather than (n-1)/2. This time, as I said before, the left-hand term goes to zero, so the +1 doesn't come into play, and the summation does not get doubled. Hence the constant term is
.
That gets you to the point where I provided the expressions. I assume you followed what I did after that to reach a closed-form expression for the summation using the identity I provided. Hope that helps! If I didn't explain it well, let me know and I'll try to clarify.
Josh