Under the heading Pentagonal Number Theorem > Relation With Partitions, Wikipedia gives the equation $$ p(n) = \sum_{k} (-1)^{k-1}p(n-g_k) $$ where the summation is over all nonzero integers k (positive and negative) and $g_k$ is the $k$th pentagonal number as in $g_k=k(3k-1)/2$ for $k=1,-1,2,-2,...$
I don't understand how this would work for even a very small $n=2$. Clearly $2$ can be expressed as $2$ or $1+1$ but that doesn't get me any closer to understanding the equation. I'm assuming that there is a lot of cancellation going on, otherwise one would have a hard time iterating over all nonzero integers $k$. Can someone explain how it is done?
The generalized pentagonal numbers begin, in order, $1, 2, 5, 7, 12, 15, ...$ .
The recurrence for the partition number is $$p(n) = p(n-1) + p(n-2) -p(n-5) -p(n-7) + p(n-12)+p(n-15) - \cdots $$ with the sign alternating in pairs.
For any given $n$, only a finite number of terms are non-zero, since $p(m)=0$ if $m<0$.
For example, $$p(2) = p(2-1)+p(2-2) - p(2-5) - p(2-7) +\cdots = 1+1 -0 - 0 +\cdots = 2.$$