Watch all Cases

Find the number of all non-negative solutions to the equation x + y + z = 2016 x+y+z = 2016 under the condition that x y z . x \leq y \leq z.


The answer is 339697.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Alan Yan
Jan 2, 2016

Generalization: \textbf{Generalization:} Find the number of all non-negative solutions to the equation x + y + z = n x+y+z = n under the condition that x y z . x \leq y \leq z.


Lemma: \textbf{Lemma:} The number of all non-negative solutions to the equation x + y = x+y = under the condition that x y x \leq y is n 2 + 1 \left \lfloor \frac{n}{2} \right \rfloor + 1

Fix x = k x = k . We have y = n k y = n-k and k n k k n 2 k \leq n-k \implies k \leq \frac{n}{2} . If n n is even or odd, the valid k k values are 0 , 1 , 2 , . . . , n 2 0, 1, 2, ..., \left \lfloor \frac{n}{2} \right \rfloor . Thus, we have proven the lemma.


Disregarding the condition, with simple stars and bars, the answer is simply ( n + 2 2 ) {n + 2 \choose 2} . Note that there are four cases: x < y < z , x = y < z , x < y = z , x = y = z x < y < z , x = y < z, x < y = z , x = y = z . Denote the number of ways to find each by ε 1 , ε 2 , ε 3 , ε 4 \varepsilon_1, \varepsilon_2, \varepsilon_3, \varepsilon_4 , respectively. We have that ( n + 2 2 ) = 6 ε 1 + 3 ε 2 + 3 ε 3 + ε 4 . {n+2 \choose 2} = 6\varepsilon_1 + 3\varepsilon_2 + 3\varepsilon_3 + \varepsilon_4. It suffices to find 1 k 4 ε k \sum_{1 \leq k \leq 4}{\varepsilon_k} . It is obvious that ε 4 = 1 \varepsilon_4 = 1 if and only if 3 n 3 | n and zero otherwise. Thus, we can write ε 4 \varepsilon_4 as n 3 n 1 3 \left \lfloor \frac{n}{3} \right \rfloor - \left \lfloor \frac{n-1}{3} \right \rfloor .

We will now try to find ε 2 + ε 3 + ε 4 \varepsilon_2 + \varepsilon_3 + \varepsilon_4 . Note that this value is just the number of solutions to 2 u + v = n 2u + v = n . Letting s = u , t = u + v s = u, t = u+v , we have s + t = n s + t = n . By the Lemma \textbf{Lemma} , we have that the number of ways to do this is n 2 + 1 \left \lfloor \frac{n}{2} \right \rfloor + 1 . Thus we have ε 2 + ε 3 = n 2 + 1 n 3 + n 1 3 ε 1 = ( n + 1 ) ( n + 2 ) 12 1 2 n 2 + 1 3 n 3 1 3 n 1 3 1 2 ε 1 + ε 2 + ε 3 + ε 4 = ( n + 1 ) ( n + 2 ) 12 + 1 2 n 2 + 1 3 n 3 1 3 n 1 3 + 1 2 \begin{aligned} \varepsilon_2 + \varepsilon_3 & = \left \lfloor \frac{n}{2} \right \rfloor + 1 - \left \lfloor \frac{n}{3} \right \rfloor + \left \lfloor \frac{n-1}{3} \right \rfloor \\ \varepsilon_1 & = \frac{(n+1)(n+2)}{12} - \frac{1}{2} \left \lfloor \frac{n}{2} \right \rfloor + \frac{1}{3} \left \lfloor \frac{n}{3} \right \rfloor - \frac{1}{3} \left \lfloor \frac{n-1}{3} \right \rfloor - \frac{1}{2} \\ \varepsilon_1 + \varepsilon_2 + \varepsilon_3 + \varepsilon_4 & = \frac{(n+1)(n+2)}{12} + \frac{1}{2} \left \lfloor \frac{n}{2} \right \rfloor + \frac{1}{3} \left \lfloor \frac{n}{3} \right \rfloor - \frac{1}{3} \left \lfloor \frac{n-1}{3} \right \rfloor + \frac{1}{2} \end{aligned} Plugging in 2016 2016 gives us our final answer.

What do you mean, @Fletcher Mattox ?

. . - 3 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...