Coinbinations (2)

Algebra Level 3

After paying for a newspaper with 4 quarters, the newspaper came out. But, to my surprise, my 4 quarters also came back out because the machine was broken. I quickly took note of how I paid for the paper: "4 quarters." After spending over a quarter of an hour at the machine, I paid for a newspaper in every possible way.

How many newspapers did I end up with?

Assumptions:

  • Only 4 kinds of coins can be used: pennies ($.01), nickels ($.05), dimes ($.10), and quarters ($.25).
  • The order of the coins placed into the machine doesn't matter.


The answer is 242.

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.

7 solutions

Chew-Seong Cheong
Nov 21, 2018

Let the numbers of quarters, dimes, nickels and pennies need to make up 1 dollar or 100 cents be q q , d d , n n , and p p respectively. Then we have 25 q + 10 d + 5 n + p = 100 25q+10d+5n + p = 100 . And note that q q can have 5 values from 0 to 4. For a q q , d d can take the value from 0 to 100 25 q 10 \left \lfloor \frac {100-25q}{10} \right \rfloor , where \lfloor \cdot \rfloor denotes the floor function . For a q q and a d d , n n can take the value from 0 to 100 25 q 10 d 5 \frac {100-25q-10d}5 . For a q q , a d d , and a n n , there can be only 1 value of p p . Therefore, to find the total number of ways to pay with the four kinds of coin N N , we need only to calculate the total number of combinations of ( q , d , n ) (q, d, n) .

N = q = 0 4 d = 0 100 25 q 10 ( 100 25 q 10 d 5 + 1 ) = q = 0 4 d = 0 10 2.5 q ( 21 5 q 2 d ) = d = 0 10 ( 21 2 d ) q = 0 + d = 0 7 ( 16 2 d ) q = 1 + d = 0 5 ( 11 2 d ) q = 2 + d = 0 2 ( 6 2 d ) q = 3 + d = 0 0 ( 1 2 d ) q = 4 = 231 110 + 128 56 + 66 30 + 18 6 + 1 0 = 242 \begin{aligned} N & = \sum_{q=0}^4 \sum_{d=0}^{\left \lfloor \frac {100-25q}{10}\right \rfloor} \left(\frac {100-25q-10d}5 + 1\right) \\ & = \sum_{q=0}^4 \sum_{d=0}^{\lfloor 10-2.5q\rfloor} (21-5q-2d) \\ & = \underbrace{\sum_{d=0}^{10} (21-2d)}_{q=0} + \underbrace{\sum_{d=0}^7 (16-2d)}_{q=1} + \underbrace{\sum_{d=0}^5 (11-2d)}_{q=2} + \underbrace{\sum_{d=0}^2 (6-2d)}_{q=3} + \underbrace{\sum_{d=0}^0 (1-2d)}_{q=4} \\ & = 231 - 110 + 128 - 56 + 66 - 30 + 18 - 6 + 1 - 0 \\ & = \boxed{242} \end{aligned}

Why is there a + 1 in the first sum? I am guessing it has something to to with the option where the pennies are used to fill up the rest of the missing coins, but I am not sure

Odin Østvedt - 2 years, 6 months ago

Log in to reply

I don't quite remember. I think it is to account for the case when 100 25 q 10 d 5 = 0 \dfrac {100-25q-10d}5 = 0 . Look at the table given by Jeremy Galvagni below. When q = 4 q=4 , then d = 0 d=0 and 100 25 q 10 d 5 = 0 \dfrac {100-25q-10d}5 = 0 but there is 1 count. I actually did a table similar to that of Jeremy from which I derived the formula to make sure that the formula is correct. You can also check it against Jeremy's table.

Chew-Seong Cheong - 2 years, 6 months ago

When expanding the inner sum, if you substitute q = 1, you get 7.5 in the expression at the top of the summation, not 7.

I assume that you can use 7 here instead of 7.5 because the term on top of the summation can be rounded down. Is this a general rule, or just applicable in this scenario? Either way, this is not intuitive to me - anyone care to offer an explanation?

p m - 2 years, 6 months ago

Log in to reply

\lfloor \cdot \rfloor denotes the floor function also known as the greatest integer function. For example 3.01 = 3 \lfloor 3.01\rfloor = 3 , 7.999 = 7 \lfloor 7.999 \rfloor = 7 , 8 = 8 \lfloor 8 \rfloor = 8 .

Chew-Seong Cheong - 2 years, 6 months ago

Log in to reply

Oh thanks! Silly me - I read that in the description but somehow thought they were square parenthesis in the equality!

p m - 2 years, 6 months ago

Log in to reply

@P M I added in the description after you have commented. Parenthesis is not necessary there. I won't key in unnessary keystrokes.

Chew-Seong Cheong - 2 years, 6 months ago

I don't get it, isn't the machine broken?

Brian Lamptey - 2 years, 6 months ago

Log in to reply

The point is, the character was supposed to attempt to buy a newspaper with all combinations of quarters, nickels, pennies and dimes that make a dollar, to see if the machine works for only certain combinations thereof.

Marc Moncada - 2 years, 6 months ago

Log in to reply

But it was a little bit confusing for me cause the problem didn't especify if diferent order of putting the coins into the maschine matters.

Pau Cantos - 2 years, 6 months ago

what type of man carries a minimum of 100 pennies 10 dimes,20 nickels and 4 quarters? Take the free paper and go home! and I have Never seen a paper machine that takes pennies( which are no longer used in progressive societies like Canada)

Doug Forbes - 2 years, 5 months ago

Log in to reply

A man who lives in the world of Math Fantasia. I share your same frustration. Read my article .

Chew-Seong Cheong - 2 years, 5 months ago
Jeremy Galvagni
Dec 2, 2018
Q D N count
4 0 0 1
3 2 1 2
3 1 3 4
3 0 5 6
2 5 0 1
2 4 2 3
2 3 4 5
2 2 6 7
2 1 8 9
2 0 10 11
1 7 1 2
1 6 3 4
1 5 5 6
1 4 7 8
1 3 9 10
1 2 11 12
1 1 13 14
1 0 15 16
0 10 0 1
0 9 2 3
0 8 4 5
0 7 6 7
0 6 8 9
0 5 10 11
0 4 12 13
0 3 14 15
0 2 16 17
0 1 18 19
0 0 20 21

The 'count' column is merely nickels+1 because you can replace any amount of n nickels with 5 pennies in n+1 ways.

The sum of the 'count' column is 242 \boxed{242} . You can add the numbers with clever tricks because there are simple sequences of even or odd numbers.

Interesting! You used brute force and math in a surprising way!

Blan Morrison - 2 years, 6 months ago

Log in to reply

I actually didn't write this all out on paper when I first solved it, but I wanted to show the whole thing here.

Jeremy Galvagni - 2 years, 6 months ago

why we dont think about order

LLL KKK - 2 years, 6 months ago

Log in to reply

Good question. The problem doesn't specify, but we seem to have assumed order of coins doesn't matter.

I suppose one could argue that if we did consider order, it would take way more than 15 minutes to use them all. (242 is already hard to believe as we'd be doing a different combination more than once every 4 seconds.) The number of combinations explodes once you realize many of the above use lots of pennies.

Jeremy Galvagni - 2 years, 6 months ago

Sort the cases by the number of pennies used. Since a nickel, a dime and a quarter are all multiples of $0.05, we have that in order to obtain a total of $1.00, a multiple of $0.05 itself, the number of pennies must be divisible by 5.

This means that we can instead consider the number of ways in which $0.00, $0.05, $0.10, ..., $0.95, $1.00 can be made up of nickels, dimes and quarters. Dividing both sides by $0.05 gives us that we can alternatively look at the number of ways in which every number from 0 0 to 20 20 can be represented as a sum of 1 1 's, 2 2 's and 5 5 's.

Label the number of ways k k can be represented as a sum of 1 1 's, 2 2 's and 5 5 's as N ( k ) N(k) . Notice that N ( k 5 ) N(k-5) counts the number of such representations that contain at least one 5 5 (one way to think about this: given that a representation contains a 5 5 , one can simply write down the number and then choose the other summands for which there are N ( k 5 ) N(k-5) ways by definition). Similarly, N ( k 2 ) N(k-2) counts the number of such representations that contain at least one 2 2 . Notice further that N ( k 7 ) N(k-7) counts the number of such representations that contain a 5 5 and a 2 2 . Hence the number of representations that contain any 5 5 's or 2 2 's is given by N ( k 2 ) + N ( k 5 ) N ( k 7 ) N(k-2)+N(k-5)-N(k-7) However, there is only one representation for k k which contains no 5 5 's or 2 2 's: namely the one consisting of k k 1 1 's. So we obtain the recurrence relation N ( k ) = N ( k 2 ) + N ( k 5 ) N ( k 7 ) + 1 N(k)=N(k-2)+N(k-5)-N(k-7)+1 Solving by hand yields

  • N ( 0 ) = 1 N(0)=1
  • N ( 1 ) = 1 N(1)=1
  • N ( 2 ) = 2 N(2)=2
  • N ( 3 ) = 2 N(3)=2
  • N ( 4 ) = 3 N(4)=3
  • N ( 5 ) = 4 N(5)=4
  • N ( 6 ) = 5 N(6)=5

From here one could either try to solve the difference equation with the given initial conditions (which would include solving a 7th degree polynomial) or just repeatedly apply the recurrence relation to obtain the values of N ( k ) N(k) for 7 k 20 7 \leq k \leq 20 . Adding all these to the above ones yields the answer 242 \boxed{242} .

Binky Mh
Dec 3, 2018

The way we will choose our coin combination will be by choosing the number of quarters, then the number of dimes, then nickels, then filling in the remainder with pennies.

# of quarters remaining cost max # of dimes
0 100 10
1 75 7
2 50 5
3 25 2
4 0 0

For now, let's only consider the coin combinations with 0 0 quarters:

For the combinations with 0 0 dimes, there are 21 21 possible combinations, as there can be any number of nickels between 0 0 and 20 20 inclusive.

For every extra dime, there will be 2 2 fewer possible combinations, as we will only be able to use up to so many nickels.

This means the number of combinations with 0 0 quarters is 21 + 19 + 17 + . . . + 3 + 1 21+19+17+...+3+1 . Following the same logic with the others:

# of quarters max # of nickels # of combinations
0 20 21 + 19 + 17 + . . . + 3 + 1 21+19+17+...+3+1
1 15 16 + 14 + 13 + . . . + 4 + 2 16+14+13+...+4+2
2 10 11 + 9 + 7 + 5 + 3 + 1 11+9+7+5+3+1
3 5 6 + 4 + 2 6+4+2
4 0 1 1

From here, we can use the formula for triangle numbers n ( n + 1 ) 2 \frac{n(n+1)}{2} to quickly find the total:

For 1 1 and 3 3 quarters, we would need 2 × 8 ( 8 + 1 ) 2 2\times\frac{8(8+1)}{2} and 2 × 3 ( 3 + 1 ) 2 2\times\frac{3(3+1)}{2} respectively. (Consider 6 + 4 + 2 = 2 × ( 3 + 2 + 1 ) 6+4+2 = 2\times(3+2+1) .)

For 0 0 and 2 2 quarters, we need the slightly more complicated ( 21 × 22 2 ) ( 2 × 10 × 11 2 ) (\frac{21\times22}{2})-(2\times\frac{10\times11}{2}) and ( 11 × 12 2 ) ( 2 × 5 × 6 2 ) (\frac{11\times12}{2})-(2\times\frac{5\times6}{2}) . This gives us:

121 + 72 + 36 + 12 + 1 = 242 121+72+36+12+1=\boxed{242}

Aaron Cao
Dec 8, 2018

We wish to find the coefficient of the x 100 x^{100} in the expansion of the generating function ( 1 1 x ) ( 1 1 x 5 ) ( 1 1 x 10 ) ( 1 1 x 25 ) \left(\dfrac{1}{1-x}\right) \left(\dfrac{1}{1-x^{5}}\right) \left(\dfrac{1}{1-x^{10}}\right) \left(\dfrac{1}{1-x^{25}}\right) . Here x x is a placeholder variable whose exponent represents an additive value (such as amount of money) and whose coefficient represents the number of combinations. With a computational tool this can be computed as 242 \boxed{242} .

Vinod Kumar
Dec 4, 2018

Find coefficient of x^100 = 242 in expansion of product of generating function

{1/(1-x)}{1/(1-x^5)}{1/(1-x^10)}{1/(1-x^25)},

Used WolframAlpha Script

SeriesCoefficient[1/(1 - x)×1/(1 - x^5)×1/(1 - x^10)×1/(1 - x^25), {x, 0, 100}]

Answer=242

Read the following pdf/link for details, hope it helps,

https://arxiv.org/pdf/1406.5213

https://arxiv.org/abs/1406.5213

Another Method

Find number of non-negative solutions (w,x,y,z) to the following Diophantine equation:

w+5x+10y+25z=100.

Python3 program can be written to solve this equation as below:

import array as a

a=a.array('i',[1, 5, 10, 25])

n=100

def diophantine_count(a,n):

"""Computes the number of nonnegative solutions (x) of the linear
Diophantine equation
    a[0] * x[0] + ... a[N-1] * x[N-1] = n

Theory: For natural numbers a[0], a[2], ..., a[N - 1], n, and j,
let p(a, n, j) be the number of nonnegative solutions.

Then one has:
    p(a, m, j) = sum p(a[1:], m - k * a[0], j - 1), where the sum is taken
    over 0 <= k <= floor(m // a[0])

Examples
--------
>>> diophantine_count([3, 2, 1, 1], 47)
3572
>>> diophantine_count([3, 2, 1, 1], 40)
2282
"""
def p(a, m, j):
    if j == 0:
        return int(m == 0)
    else:
        return sum([p(a[1:], m - k * a[0], j - 1)
                    for k in range(1 + m // a[0])])

return p(a, n, len(a))

print(diophantine_count(a,n))

Answer=242

Okay, this is correct, but why is it correct?

Blan Morrison - 2 years, 6 months ago

Log in to reply

Read the following pdf/link for details, hope it helps,

https://arxiv.org/pdf/1406.5213

https://arxiv.org/abs/1406.5213

Vinod Kumar - 2 years, 6 months ago

Log in to reply

Was kinda hoping for an original explanation, but this works too. More detail than anyone could've ever provided; thanks!

Blan Morrison - 2 years, 6 months ago

Using Wolfram Mathematica 11..3.

Yes, this could have done in other languages. that support recursion, big integers and memoization of previously computed answer.

Another example of this class of problem: How many ways of making change for a $1000 banknote, including just returning the input, and using combinations of $500, $100, $50, $20, $10, $5, $2, $1, $0.50, $0.25, $0.10, $0.05 and $0.01 bills or coins.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...