When I was at the ARML Power Contest, I came upon question 11 which stated: Explain why the number of partitions of \(n\) into all different parts is given by the coefficient of \(x^{n}\) in the expansion of the product \(\left(1+x\right)\left(1+x^{2}\right)\left(1+x^{3}\right)...\left(1+x^{n}\right)\).

The answer explains how, when the product is expanded but like terms are not collected, each different term that is \(x^{n}\) is formed from adding the powers of several terms from the initial semi-factored form.

I was wondering, does anybody know if there's a generating function or regular old function for the total number of partitions a number can be split into? I tried finding one in terms of sigma, then started working on a Python solution, but it doesn't seem like there is. The formulas I used had to do with combinations and even the same kind of logic that is used to determine the number of ways a certain number can be rolled using any number of dice. If an experienced computer scientist can come up with a great Python or Java version, that would be great also.

Thanks,

Tristan Shin

## Comments

Sort by:

TopNewestFor regular partitions, the generating function is \[\frac{1}{(1 - x)(1 - x^2)(1 - x^3) \dotsm}.\] See http://en.wikipedia.org/wiki/Partition

%28numbertheory%29 – Jon Haussmann · 3 years, 6 months agoLog in to reply

– Tristan Shin · 3 years, 6 months ago

Thanks! It seems that just a little bit of manipulation can cause wonderful generating functions!Log in to reply