How would I solve this counting? question?

76 Views Asked by At

Donkey Kong has 63750 banana coins to purchase a number of balloons and barrels from Funky Kong’s shop. Each balloon costs 7 banana coins, and each barrel costs 15 banana coins. If Donkey Kong must buy at least twice as many balloons as barrels, how many ways can he spend all of his banana coins?

I'm not really sure where to start his... Is this a counting problem? Because what we learned in class is Prime defactorization but I don't see how this applies here.

2

There are 2 best solutions below

0
On BEST ANSWER

We must spend all our banana coins, so we have to make sure that if $x$ is the number of balloons we buy and $y$ is the number of barrels we buy, that $7x+15y=63750$ exactly. $63750=2\times 3\times 5^4\times 17$ which is divisible by 15 but not divisible by 7 (notice $3\times 5=15$ is a factor of 63750 but 7 is not). If we ignore the balloon greater than barrel restriction, this means we cannot buy only balloons, but we can buy all barrels (we can buy $63750/15=(2\times 3\times 5^4\times 17)/15=2\times 5^3\times 17=4250$ barrels to be exact).

However, we have the further restrictions that we must buy twice as many balloons as barrels. First lets just try to find some combination of balloons and barrels that works. We'll do that by subtracting multiples of 15 from 63,750 to buy barrels with, then when we get a multiple of 7 remaining, we'll use that to buy some balloons. Our first try works, $63750=63750-15+15=63735+15=9105*7+15$, so we can buy 9105 balloons and one barrel.Notice that $7\times 15$ is 105, so the next one that works (think about why) is $63735-105+105+15=63630+120=9090*7+8*15$ which gives 9090 balloons and 8 barrels.

We've got way more balloons than barrels right now, so no problem, but eventually by subtracting 105 from 9105 multiple times, we'll get to a point where there are less than twice as many balloons as barrels.

Back to the equation $7x+15y=63750$, let's put $x=2y$ in and get an idea of how many of each we should get (it won't be exact as it won't be an integer). $7x+15y=7*(2y)+15y=29y=63750$ so $y=2198.27$ or so, giving us about 2198 barrels and about twice that many balloons.

Trying a couple number close to 2198, we find if we buy 2199 barrels then we can buy 4395 balloons to make the cost exactly 63750 banana coins. Unfortunately, that's just a bit off as $2199\times 2=4398$ so we haven't quite bought twice as many balloons as barrels. The first pair that works is 2192 barrels and 4410 balloons. ($2192\times 2=4286\le4410$).

So the most balloons we can buy is $9105$ and the fewest is $4410$ and we can only buy multiples of 15 balloons. Therefore we can buy balloons and barrels in $(9105-4410)/15+1=314$ ways.

Note: I've solved this using no advanced math as the poster is just learning about factorization.

1
On

First, note that one can think of each barrel as containing two balloons and costing $15+2\times 7=29$ coins; then the question becomes in how many ways can $63750$ coins be spent completely spent on items of prices $29$ (filled barrels) and $7$ (unbarrelled balloons). Or in mathematical terms, the size of the set $$ \{\, k,l\in\Bbb N \mid 29k+7l=63750\,\} \qquad\text{where $0\in\Bbb N$.} $$ (It is the coefficient of $X^{63750}$ in ${1\over1-X^{29}}\times{1\over1-X^7}$, though that does not seem particularly helpful here.)

For a very basic approach, search for the solutions with (say) maximal value of $k$ first. Euclidean division of $63750$ by $29$ gives quotient $2198$ and remainder $8$, but we need a leftover that is divisible by $7$, so we need to trade back in a number of those terms $29$, each of which adds $29\bmod 7=1$ to the leftover modulo $7$; we need to add $6$, so writing $63750=2192\times29+26\times7$ is the solution with largest $k$. Other solutions can be found by decreasing $k=2192$ by some $7m$ and increasing $l=26$ by $29m$, and (since $29$ and $7$ are relatively prime) all solutions can so be obtained. Valid values for $m$ are integers with $0\leq m\leq 313$ (the final solution being $63750=1\times29+9103\times7$), so there are $314$ solutions.