i enjoyed this one when i heard it sometime last year, and i thought i'd
i have $1.19 in ten coins. i can't make change for a dollar, a half
dollar, a quarter, a nickle, or a dime. all coins are in standard US
currency. there are no trick or counterfeit coins.
I'm a bit lazy at the moment (at least for riddles like this),
so would it be possible to post all possible coins you have there in the
US. (And what value... like what's a dime, etc...?)
All valid coins are Half-Dollar (50 cents), quarter (25 cents), Dime (10
cents), Nickle (5 cents), and Penny (1 cent)
Hmmm.... I have come up with a solution but I won't post it right now...
mine doesn't require the 1 dollar coin.
It seems I am hopeless in thinking myself. :)
I spent 15 minutes and wrote a Perl function that produced one solution. :)
It is possible that I would spend less time trying different variants
myself. This will remain unknown.
Somehow, I don't think the intent of this puzzle was to force people to
start writing Perl code. :-)
(And yes, I have a solution.)
The solution is really easy. You should be able to mentally get it or by
trial and error within a short time.
i forgot to add the line what coins do i have, but i guess it was assumed.
no the intent wasn't to produce perl code, but i think its great if you
did. i usually try to write some code to solve problems here.
the answer is pretty easy to figure out mentally. i'll post it tomorrow if
you like :).
tomc: of course the task is trivial and does not requere any mathemathical
background. So I wanted to add some fun to it for myself. :)
I believe I've figured it out using mainly trial and error. Nice problem.
If you like this kind of puzzles, try to express 119 cents using 11 coins,
then 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 coins.
The expression does not need to be non reducible (i.e. 25+25 is ok).
Hint: there is no solution for 15 and 18 coins.
There is also no solution for less than 10 coins.
Mikhael, why do you say there is no way to have 119 cents with 15, 18, or
fewer than 10 coins? All of these are possible, for example as follows:
4*1 + 1*5 + 1*10 + + 2*50 = 119, using 8 coins.
4*1 + 2*5 + 8*10 + 1*25 = 119, using 15 coins.
4*1 + 5*5 + 9*10 = 119, using 18 coins.
Maybe there's an error in your perl function? ;-)
In case anyone's still wondering what the solution to the original problem
is, here's the one I found. (I suspect it's the only one.)
4*1 + 4*10 + 1*25 + 1*50 = 119, using 10 coins, with no way to make change.
2 * 50 would be change for a dollar :).
when i solved it, it was by trial and error as well.
i'll post the answer when i get back from work today.
i'm glad everyone enjoyed the problem.
Michael: no, there is no error in my function, but in its input. :)
I don't know why, but I programmed it to use (1, 10, 25, 50, 100).
I am not American at all, so this set of coins looked just fine for me. :)
After adding the 5 cent coin. I get results for 7, 8, 9, 15 and 18 coins:
119 = 1 + 1 + 1 + 1 + 5 + 10 + 100
119 = 1 + 1 + 1 + 1 + 5 + 5 + 5 + 100
119 = 1 + 1 + 1 + 1 + 5 + 5 + 5 + 50 + 50
So, I solved a task for a more restricted currency system, but the answer
for 10 coins does not use 5 cents, so it ok for the original task too. :)
>> i have $1.19 in ten coins. i can't make change for a dollar, a half
>> dollar, a quarter, a nickle, or a dime. all coins are in standard US
>> currency. there are no trick or counterfeit coins.
>All valid coins are Half-Dollar (50 cents), quarter (25 cents), Dime (10
>cents), Nickle (5 cents), and Penny (1 cent)
Ok, now please, someone tell me that that first "or" is an exclusive one.
BTW: strange how things can go, the dollar has quarters, while they opted
for 20 eurocent here (and an additional 2 eurocent)
and for 1 and 2 eurocoins instead of notes