Partition of n into k distinct partitions modulo $p$

220 Views Asked by At

Given $N$ and $K$ we have to find the number of partitions of $N$ into at most $K$ parts modulo $p$.
I was wondering if there was any formula to calculate this type of query.
I know about the recurrence formula $p_k(n)=p_k(n−k)+p_{k−1}(n)$ also about the ferrers diagram
But this can be used when $N$ and $K$ are small
I need to find for $1\leq N,K \leq2*10^5$

1

There are 1 best solutions below

0
On

But this can be used when $N$ and $K$ are small
I need to find for $1\leq N,K \leq2*10^5$

Those are small.

That aside, a little thought experiment. Suppose that a nice formula were known for $p_k(n) \bmod m$. There are easy upper bounds on $p_k(n)$: for example, $p_k(n) \leq (n-k+1)^{k-1}$. Substitute for $m$ and our nice formula for $p_k(n) \bmod (n-k+1)^{k-1}$ is just a nice formula for $p_k(n)$. But I don't see a nice formula in OEIS, and this is a well-studied and well-referenced sequence, so it's very unlikely that one is known.