Doge has become the king of a huge empire and wants to show the world that he is really intelligent. He is so over ambitious that his first action as king is to name the currency after himself: DogeCoin . He wants to issue d denominations of coins so that using no more than 3 coins, citizens can pay any amount from 1 DogeCoin to 36 DogeCoin in exact change.
Find the minimum value of d and all the corresponding denominations of DogeCoin. Submit your answer as the sum of these denominations.
Details and Assumptions :
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.
What's wrong with this solution? He's correct, give him the upvote he deserves! The combinatorial approach to this problem suggests expanding out ( 1 + x + x 4 + x 6 + x 1 4 + x 1 5 ) 3 and checking if every term from 1 to 3 6 has a coefficient not equal to 0 . I plugged this into wolfram alpha to check his solution and it's correct.
Log in to reply
Thoughts on how we can prove uniqueness of the answer?
Thoughts on how to come up with those numbers would help.
01 = 01
02 = 01 + 01
03 = 01 + 01 + 01
04 = 04
05 = 04 + 01
06 = 04 + 01 + 01
07 = 06 + 01
08 = 04 + 04
09 = 04 + 04 + 01
10 = 06 + 04
11 = 06 + 04 + 01
12 = 06 + 06
13 = 06 + 06 + 01
14 = 06 + 04 + 04
15 = 15
16 = 15 + 01
17 = 15 + 01 + 01
18 = 06 + 06 + 06
19 = 15 + 04
20 = 15 + 04 + 01
21 = 15 + 06
22 = 15 + 06 + 01
23 = 15 + 04 + 04
24 = 14 + 06 + 04
25 = 15 + 06 + 04
26 = 14 + 06 + 06
27 = 15 + 06 + 06
28 = 14 + 14
29 = 14 + 15
30 = 15 + 15
31 = 15 + 15 + 01
32 = 14 + 14 + 04
33 = 14 + 15 + 04
34 = 14 + 14 + 06
35 = 14 + 15 + 06
36 = 15 + 15 + 06
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
Somehow i achieved the answer by if it is a prime, i decremented it by one and to get minimum, i replaced for 24 with 14 @M Usman , How did you get the result
But how will you make 36?? The three highest denominations add up to 35....
Log in to reply
2x 15 + 1x 6.
Log in to reply
Damn!! How did I miss this? That was easy...thanks for explanation.
Last time I had read a similar puzzle, it had a condition that you may not use the same coin twice.
1,3,9,27 - minimum denominations
powers of 3
Ans = 40
This solution assumes that the seller is allowed to give you coins back in return.
That's incorrect ... Taking back is not allowed .. You are supposed to pay using three coins, without taking anything back
Log in to reply
Why taking back is not allowed.Is it mention in question?
Log in to reply
sorry for the pretty late reply. Haven't been checking for quite some time now. Read the question carefully .. you will understand why taking back is not allowed.
However you get the sum as correct, without having the correct values individually
How do you do 8 with 3 coins ?
Log in to reply
Giving 9 rupee coin and the seller give 1 rupee coin
And how do you make 14 without using all four?
Log in to reply
I give one ( ≤ 3 )coin (27) and the seller give three ( ≤ 3 ) coin (1,3,9) 27-1-3-9=14
Log in to reply
Is it so? I thought that the whole transaction should involve 3 or less coins...thats why.. And one more thing its not 4 its 3.....
Definition: Let c , d be the number of coins and denominations, and v ( { c } ) the number of different values using exactly c coins.
Recall some combinatorics:
Theorem: If we choose k unordered elements from a set of n distinct elements with repetitions, there are ( n − 1 k + n − 1 ) possible choices.
First we show there can be no solution with d < 5 denominations. Notice that we may choose any coin more than once, so the above theorem will be useful! Notice as well that different combinations of coins may lead to the same value, so we can only give an upper bound: The maximum number of different values (when they are pairwise disjoint) is given by v ( { c } ) ≤ ( d − 1 c + d − 1 ) , v ( { 1 ≤ c ≤ c m a x } ) ≤ c = 1 ∑ c m a x ( d − 1 c + d − 1 ) = c = 0 ∑ c m a x ( d − 1 c + d − 1 ) − 1 = ( d c m a x + d ) − 1
Plug in c m a x = 3 to get v ( { 1 ≤ c ≤ 3 } ) ≤ 6 ( d + 3 ) ( d + 2 ) ( d + 1 ) − 1 ≤ 3 4 < 3 6 for any 1 ≤ q ≤ 4
One can obtain (at most) 34 distinct values with four or less coins. Any minimal solution must have (at least) d = 5 denominations!
Check all denominations with d = 5 using maxima - even with the elimination scheme used in the program below there are several hundred cases left. The only solution returned is
( 1 ; 4 ; 6 ; 1 4 ; 1 5 ) ⇒ 1 + 4 + 6 + 1 4 + 1 5 = 4 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
This solution assumes that the seller is allowed to give you coins back in return.
You cannot get 26 because you "took back" a coin. Similarly, you cannot get 32 or 33.
If you are allowed to take back coins, you can use 4 coins with denomination 1, 3, 9, 27.
Is there any 'mathematical' way to get the solution? (I did bf in python)
Problem Loading...
Note Loading...
Set Loading...
1,4,6,14,15 you can easily made any number from 1 to 36 by adding at maximum 3 coins of above mentioned value.