# Simplifying Hypergeometric Function

thissum = Sum[2^k n/(n - k) Binomial[n - k, 2 k], {k, 0, n/3}];


Mathematica finds:

HypergeometricPFQ[{1/3 - n/3, 2/3 - n/3, -(n/3)}, {1/2, 1 - n}, 27/2]


In fact the sum has the simple closed form expression: $2^{n-1}+\cos(n \pi/2)$. Try it!

If I use FullSimplify and specify that n is a positive integer it returns ComplexInfinity. How can I get Mathematica to give the simpler answer?

Writing:

Sum[2^k n/(n - k) Binomial[n - k, 2 k] // FunctionExpand, {k, 0, n/3}] // ComplexExpand


I get:

2^(-1 + n) + Cos[(n \[Pi])/2]


which is what you want.

Just in case for the next time it pays to have several methods. Here is a different way:

Table[Sum[2^k n/(n - k) Binomial[n - k, 2 k], {k, 0, n/3}], {n, 3, 39,3}]
FindSequenceFunction[%, n] // ComplexExpand

{4, 31, 256, 2049, 16384, 131071, 1048576, 8388609, 67108864, \
536870911, 4294967296, 34359738369, 274877906944}

2^(-1 + 3 n) + Cos[(n \[Pi])/2]

• This is interesting but it isn't giving the correct solution. If you change the enumerations in the table from {n,3,39,3} to {n,1,8} it gives the correct answer. – JEP Mar 19 '17 at 18:58
• Hi JEP; I left it that way on purpose. Due to the way FindSequenceFunction fits this uses 1,2,3,4,5... instead of your 3,6,9,12... I think it makes more sense to count by ones instead of threes. But it is a simple matter to change it back. – bobbym Mar 19 '17 at 20:25