0
$\begingroup$

This question already has an answer here:

How many solutions for the equation $Y_1 + Y_2 + Y_3 + Y_4 + Y_5 = 6$ ?

where $0\leq Y_1 \leq 3$ and $1\leq Y_2 \leq3$ and $Y_3,Y_4,Y_5\geq 0$ and $Y1,Y2,Y3,Y4,Y5 $ are integers.


I tried to apply brute force and got following equations :

  • $Y3 + Y4 + Y5 = 5\quad$ has $21$ Solutions
  • $Y3 + Y4 + Y5 = 4\quad$ has $15$ Solutions
  • $Y3 + Y4 + Y5 = 3\quad$ has $10$ Solutions
  • $Y3 + Y4 + Y5 = 2\quad$ has $6$ Solutions
  • $Y3 + Y4 + Y5 = 1\quad$ has $3$ Solutions
  • $Y3 + Y4 + Y5 = 0\quad$ has $1$ Solution

Am I going right here ?

EDIT: Using generating functions gives $106$, but what is the error in above method.

$\endgroup$

marked as duplicate by Jon Garrick, Community Jan 15 '17 at 5:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Add that they are integers. $\endgroup$ – Gyanshu Jan 15 '17 at 5:11
  • 1
    $\begingroup$ From a program I put together, it appears the answer is 106 (if this helps). $\endgroup$ – Mark Jan 15 '17 at 5:21
  • $\begingroup$ @Mark Yes,I used generating functions and got 106. I'll edit that. But, why above method is not right ? $\endgroup$ – Jon Garrick Jan 15 '17 at 5:23
  • $\begingroup$ What you have noticed is that the number of ways to sum three numbers to make $n$ is $T_{n+1},$ the $(n+1)$st triangular number, which is $\frac 12(n+1)(n+2)$ $\endgroup$ – Ross Millikan Jan 15 '17 at 5:24