Sorry.
I wrote: "Its a recursive algorithm for my own integerPartionsP[n,{k}]. Unfortunately Mathematica knows IntegerPartitionsP[n], but not that parameter k."
This has to read: "Its a recursive algorithm for my own partionsP[n,{k}]. Unfortunately Mathematica knows PartitionsP[n], but not that parameter k."
Basically it is very simple. To get the number of integer partitions of n with exactly k parts just implement the well known formula:
P(n,k) = P(n-1,k-1) + P(n-k,k), where P(n,k)=0 for k<1||k>n, P(n,k)=1 for k=1||k=n.
partitionsPsimple[n_Integer, {k_Integer}] :=
If[k < 1 || k > n, 0,
If[k == 1 || k == n, 1,
partitionsPsimple[n - 1, {k - 1}] + partitionsPsimple[n - k, {k}]
]
]
But for larger n and k this takes astronomical time and exceeds all reasonable recursion limits. That is why I want to store every intermediate result in a persistent sparse array and reuse it. Then it seems to be usable.