Pentagonal recurrence
P(n) = sum_{k≥1} (-1)^(k-1) [P(n - g_k) + P(n - g_{-k})] where g_k = k(3k-1)/2 pentagonal numbers.
Advertisement
Complexity
Fast: O(N^(1.5)) for all P(n), n ≤ N. Slower DP O(N²).
Advertisement
Restricted partitions
Distinct parts. Parts from given set. Each has closed-form generating function.