A site for technical interview questions, brain teasers, puzzles, quizzles (whatever the heck those are) and other things that make you think!
Every night, I dump all the change in my pocket into a big bucket.
When I buy things, I never hand over coins. always bills. So I accumulate a lot of coins. Even if the purchase price is $1.01, and I have lots of coins in my pocket, I pay $2 and take the 99 cents in change. All the more coins to dump in my change bucket!
After about 10 years of this, I decide to roll all the coins into rolls. Remember that a quarter roll is $10, a dime roll is $5, nickels $2, pennies 50 cents. So I go to the Banking Supply Store and buy empty paper rolls.
The Banking supply store, conveniently, sells assortment packs of coin rolls. Each assortment pack contains W quarter rolls, X dime rolls, Y nickel rolls, and Z penny rolls.
The question: what is the optimum ratio of W to X to Y to Z to maximize the probability that I will use up the assortment packs at the same rate, e.g. without lots of leftover nickel tubes and stuff?
P.S. this problem should ideally be solved using Excel (but if you really like doing these things by hand, be my guest).
submitted by joel
paul brinkley makes these assumptions which are all good assumptions to make:
Assumption 1: The price of purchases made, modulo $1, is an even distribution from 0 cents to 99 cents.
Assumption 2: The cashier will always give you the least number of coins mathematically possible, and will always have enough of each type of coin to do this. So you’ll never get 99 pennies as change for a $1.01 purchase, for example.
Assumption 3: Half dollars don’t exist.
“Brute force” approach:
I guess I’ll begin with a few assumptions:
Assumption 1: The price of purchases made, modulo $1, is an even distribution from 0 cents to 99 cents. Probably not true, but we can cover that later.
Assumption 2: The cashier will always give you the least number of coins mathematically possible, and will always have enough of each type of coin to do this. So you’ll never get 99 pennies as change for a $1.01 purchase, for example.
Assumption 3: Half dollars don’t exist.
Over the long haul, then, you’d get N sets of 0 cents, 1 cent, 2 cents, and so on up to 99 cents. So let’s consider one of each. How many of each coin would you end up with?
Easy first: let’s do quarters. 25-49 cents each gets you one. 50-74 each gets you two. 75-99 each gets you three. That’s (1+2+3)*25, or 150 quarters.
Dimes next. 10-19 gets you one. 20-24, two. (You’d get a quarter instead for 25 and up.) 35-44, one. 45-49, two. 60-69, 85-94, one. 70-74, 95-99, two. So that’s 4*(10+5*2), or 80 dimes.
Nickels. One for 5-9, 15-19, and that same pattern for +25, +50, +75, so it’s 4*10 or 40 nickels. You’ll never get two at a time, since a dime (at least) will do.
Pennies. Let’s cut to the chase: 1,2,3, and 4 cents gets 10 pennies in all, and that pattern happens 20 times, so that’s 200 pennies.
Let’s double-check. 200 pennies, 40 nickels, 80 dimes, 150 quarters. That’s 200*1 + 40*5 + 80*10 + 150*25 cents = 200+200+800+3750 = 4950 cents, which is the sum of all numbers from 0 to 99, so it checks.
15/8/4/20 would be the ratio then, IF coin rolls all hold the same number of coins, but they don’t. Quarter rolls hold 40 coins, dime rolls hold 50, nickel rolls 40, penny rolls 50. So you need 5/4 as many quarter and nickel rolls. The final ratio is 75/32/20/80. Seems like a lot of quarters and pennies, except for the assumption that you’ll tend to get them much more often than nickels and dimes as change.
The numbers change slightly when you figure in things like frequency of coins in circulation, the supply the cashier has at any one time, the actual distribution of change values, and the cashier’s inclination to give you two dimes and a nickel instead of a quarter just because…
So what numbers do assortment packs really contain?