0

Question

Consider the following prices on balls:

\begin{alignat}{2} &\text{Red (R):} & 15&\\ &\text{Green (B):} & 6&\\ &\text{Blue (G):} &\qquad 8& \end{alignat}

Question

Is there an "elegant" way of finding all the possible ways of bying balls for a total sum of $90$?

My own approach

By a brute force search, I have found the following possibilities, but can I somehow find this in a more "elegant" way?

\begin{alignat}{3} (0\,&\text{R},{} & 3\,&\text{G},{} &9\,&\text{B})\\ (0\,&\text{R}, & 7\,&\text{G}, &6\,&\text{B})\\ (0\,&\text{R}, &11\,&\text{G}, &3\,&\text{B})\\ (0\,&\text{R}, &15\,&\text{G}, &0\,&\text{B})\\ (2\,&\text{R}, &10\,&\text{G}, &0\,&\text{B})\\ (2\,&\text{R}, & 2\,&\text{G}, &6\,&\text{B})\\ (2\,&\text{R}, & 6\,&\text{G}, &4\,&\text{B})\\ (4\,&\text{R}, & 1\,&\text{G}, &3\,&\text{B})\\ (4\,&\text{R}, & 5\,&\text{G}, &0\,&\text{B})\\ (6\,&\text{R}, & 0\,&\text{G}, &0\,&\text{B}) \end{alignat}

Update

$(2\,\text{R},{} 6\,\text{G},{} 4\,\text{B}) \to (2\,\text{R},{} 6\,\text{G},{} 3\,\text{B})$

2 Answers2

5

We are looking for values $r,g,b$ such that $$15r +6g + 8b = 90.$$ Immediately note that since $15$ is odd, $r$ must be even, let $r = 2R$. Then we want

$$30R + 6g + 8b = 90.$$

Next, observe that $6|\;30R,\;6g,\;90 \implies 6|8b,$ so $b$ must be a multiple of 3, let $b=3B$, now we want

$$30R + 6g + 24B = 90$$

$$\iff 5R + g + 4B = 15$$

Now I would consider the cases $R=0,1,2,3$, there is still some case by case work to do but perhaps it's easier.

Dylan
  • 862
  • 5
  • 10
1

Your answer $(2,6,4)$ is incorrect.

Idk what method you have adopted, here is one systematic approach that you could using simple Diophantine equations.

Firstly reduce $15r + 6b + 8g = 90$ to $5r +2b + {\frac8 3}g = 30$.

So $g$ can only be from $0, 3,6,9$ with the corresponding reduced values of the totals being $30$, $22$, $14$, and $6$.

For each of these totals, we can form Diaphontine equations in two variables, eg for the total of $30$.

$5r + 2b = 30,\, b = 15 - \frac 5 2 r$

which immediately yields $(r,b,g)$ values of $(0,15,0), (2,10,0), (4,5,0)$ and $(6,0,0)$.

Similarly for the other three cases, you get the equations

$b = 11 - \frac5 2r,\quad b = 7 - \frac5 2r,\quad b = 3 - \frac5 2 r$

which you can enumerate similarly.