For an equation,
a + b + c = D

where D is a natural number and a, b, c are variables, what is the quickest way to find the number of natural number solutions to this equation?


closed as off-topic by Namaste, Thomas Andrews, Xam, Ethan Bolker, kingW3 Nov 11 '17 at 20:07

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – Namaste, Thomas Andrews, Xam, Ethan Bolker, kingW3
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ First, share with us one way you know to find the same. Then we can better understand what might be quicker. $\endgroup$ – Namaste Nov 11 '17 at 18:07
  • $\begingroup$ @amWhy That would be taking values from 1 to D - 2 for one of the variables and manually counting the possibilities for the the other two variables. For example. when c = 1, a + b = D - 1 , now I would count all possibilities for this, then take c = 2, and keep going until D - 2. $\endgroup$ – Nick Adams Nov 12 '17 at 7:46

Stars and bars.

The problem can be reformulated in the following way:

Suppose we have $D+2$ places where we want to put two bars and $D$ stars. Thus the number of solutions is $D+2 \choose 2$.


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