Handing out coupons problem

I am trying to make an equation in excel but I can come up with it. I am handing out coupons to people. Everyone will get 1,2 or 3 coupons. I know how many people and how many coupons I have used. What I need to know is how many people got 1x,2x and 3x coupons.

Example 10 people 21 coupons 1 coupons = 0 2 coupons = 9 3 coupons = 1

What would be the equation for 10 people and 18 coupons

Let the number of people who have 1 coupon be a, the number of people who have 2 coupons be b, the number of people who have 3 coupons be c.

a, b, c are non-negative integers and satisfy the following equations:

1) a + b + c = 10

2) a + 2b + 3c = 18

With this in mind, we wish to find the solutions to this system of Diophantine equations. More info here: http://en.wikipedia.org/wiki/Diophantine_equation

Since the numbers are small, it would work to just enumerate the possible solutions.

(a, b, c) = (2, 8, 0), (3, 6, 1), (4, 4, 2), (5, 2, 3), (6, 0, 4)

The general solution (for negative integers as well) can be expressed as

(a, b, c) = (2 + t, 8 - 2t, t) and the above solutions are found from the values of t giving nonnegative solutions.

Note that there are more variables than equations, and this is the main reason why there is more than 1 solution. For example, your example of 21 coupons have solutions (0, 9, 1), (1, 7, 2), (2, 5, 3), (3, 3, 4), (4, 1, 5).