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

How would I count the number of integer solutions to: $a+b+c+d=n$, $a \geq b \geq c \geq d \geq 0$. Thanks for your help!

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

In order to solve the problem with $a\geq b\geq c\geq d\geq 0$, we are gonna use generating functions. First note that we can write $$ a+b+c+d=n $$ as $$ a+b+c^{'}+2d=n, $$ where we used $c=c^{'}+d$ for some $c^{'} \geq 0$ Repeating this process, we get $$ a^{'}+2b^{'}+3c^{'}+4d^{'}=n \,\, a^{'},b^{'},c^{'},d^{'}\geq 0. $$ Now if you are familiar with generating functions, see for example Generating functions for combinatorics, you recognize that the generating function of this equation is the product of $$ \frac{1}{1-x}\frac{1}{1-x^2}\frac{1}{1-x^3}\frac{1}{1-x^4}. $$ You seek the coefficient of $x^n$ in the power series of this function. It starts like $$ 1+x+2\,{x}^{2}+3\,{x}^{3}+5\,{x}^{4}+6\,{x}^{5}+9\,{x}^{6}+11\,{x}^{7 }+15\,{x}^{8}+18\,{x}^{9}+23\,{x}^{10}+27\,{x}^{11} $$ You can find this sequence on OEIS for a greater list.

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.