Problem with QPochhammer or SeriesCofficient?

In version 10.2.0, I calculated the number of integer partitions of n into exactly k distinct parts with no part exceeding m by using PochhammerDistinct[n,k,m].

$Version 10.2.0 for Linux x86 (64-bit) (July 6, 2015) PochhammerDistinct[n_, k_, m_] := Coefficient[SeriesCoefficient[QPochhammer[-t*z, z, m], {z, 0, n}], t^k] This function is based on the answer by @ciao here. For example, there are 9 partitions of 28 into exactly 4 distinct parts with no part exceeding 10. PochhammerDistinct[28, 4, 10] 9 Select[IntegerPartitions[28, {4}, Range], Length[Union[#]] == 4 &] {{10, 9, 8, 1}, {10, 9, 7, 2}, {10, 9, 6, 3}, {10, 9, 5, 4}, {10, 8, 7, 3}, {10, 8, 6, 4}, {10, 7, 6, 5}, {9, 8, 7, 4}, {9, 8, 6, 5}} However, in versions 10.3.1, 10.4.1, and 11.0.1 for 64-bit Linux, the same function gives the following. PochhammerDistinct[28, 4, 10] How to I convert this new answer into the integer 9? Is this a bug? Does the weird functional form persist in v11.1.0? • Try PochhammerDistinct[n_, k_, m_] := Coefficient[SeriesCoefficient[FunctionExpand[QPochhammer[-t z, z, m]], {z, 0, n}], t^k]. This is apparently the same problem as this one. – J. M. will be back soon Mar 21 '17 at 2:50 • @J.M. - your approach works with version 11.0.1 and 11.1.0 for Mac OS X – Bob Hanlon Mar 21 '17 at 3:18 1 Answer As already noted, the workaround needed is to apply FunctionExpand[] to the finite$q\$-Pochhammer symbol:

PochhammerDistinct[n_, k_, m_] := Block[{t, z},
Coefficient[SeriesCoefficient[FunctionExpand[QPochhammer[-t z, z, m]], {z, 0, n}], t^k]]

From here,

PochhammerDistinct[28, 4, 10]
9