Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Given natural number $n$, how many multisets are there which sum of their elements equals $n$?

There is a recursive function which can give the value in $O(n^2)$, but is there a formula for that?

$f(n,i)$ = answer where minimum elements of multisets are at least $i$.

$f(n,i) = 1$ for $n=0$

$f(n,i) = 0$ for $i>0$

$f(n,i) = f(n,i+1) + f(n-i,i)$ for $ 0 < i \le n$

share|cite|improve this question
up vote 0 down vote accepted

If you're speaking only of positive integers, then you're talking about partitions of an integer. There is an extensive literature on this topic.

See this Wikipedia article.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.