# Different result with HypergeometricPFQ

I have a following sequence:

 Table[Sum[Sum[(1 + j + k + n)!/((1 + j + k) j! k! ), {j, 0, n}], {k, 0, n}], {n, 1, 5}]
(* {16, 542, 31488, 2646024, 292224000} *)


The sum inside can be evaluated:

 Sum[(1 + j + k + n)!/((1 + j + k) j! k! ), {j, 0, n}]
(* -(((2 + k + 2 n)! HypergeometricPFQ[{1, 2 + k + n, 3 + k + 2 n}, {2 + n, 3 + k + n}, 1])/((2 + k + n) k! (1 + n)!)) *)


But the same sum with substitution gives an error message.

 Table[Sum[-(((2 + k + 2 n)! HypergeometricPFQ[{1, 2 + k + n, 3 + k + 2 n}, {2 + n, 3 + k + n}, 1])/((2 + k + n) k! (1 + n)!)), {k, 0, n}], {n, 1, 5}]
(* Infinity::indet: Indeterminate expression ComplexInfinity+ComplexInfinity encountered. *)


Why aren't the results the same?

• Are you aware that you don't need to use Sum[] twice? Sum[(1 + j + k + n)!/((1 + j + k) j! k!), {j, 0, n}, {k, 0, n}] Apr 3 '19 at 12:59
• Yes, of course (see tens of my programs in the OEIS, for example in oeis.org/A144661) Apr 3 '19 at 13:07

The problem that the hypergeometric result returned is not good for integer arguments:

Table[HypergeometricPFQ[{1, 2 + k + n, 3 + k + 2 n}, {2 + n, 3 + k + n}, 1],
{n, 2}, {k, 0, n}]
{{ComplexInfinity, ComplexInfinity}, {ComplexInfinity, ComplexInfinity, ComplexInfinity}}


which spoils further computations.

A useful tactic is to flip indices in the inner sum:

Sum[(1 + n - j + k + n)!/((1 + n - j + k) (n - j)! k!), {j, n, 0, -1}]
((1 + k + 2 n)! HypergeometricPFQ[{1, -1 - k - n, -n}, {-1 - k - 2 n, -k - n}, 1])/
((1 + k + n) k! n!)


which should now be usable:

Table[Sum[((1 + k + 2 n)! HypergeometricPFQ[{1, -1 - k - n, -n},
{-1 - k - 2 n, -k - n}, 1])/((1 + k + n) k! n!), {k, 0, n}], {n, 1, 5}]
{16, 542, 31488, 2646024, 292224000}


It should be noted that index flipping does not always give a useful result, but we are fortunate in this case.

• Yes, this is a good idea, thank you! Apr 3 '19 at 13:22