Doge, the king? (Faints)

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 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 d and all the corresponding denominations of DogeCoin. Submit your answer as the sum of these denominations.

Details and Assumptions :

  • As an explicit example, if you get the denominations as { 10 , 12 , 15 } \{10, 12, 15\} , then input the answer as 10 + 12 + 15 = 37 10+12+15=37 .


The answer is 40.

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.

4 solutions

M Usman
Aug 4, 2015

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.

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 14 + x 15 ) 3 (1+x+x^4+x^6+x^{14}+x^{15})^3 and checking if every term from 1 1 to 36 36 has a coefficient not equal to 0 0 . I plugged this into wolfram alpha to check his solution and it's correct.

Garrett Clarke - 5 years, 10 months ago

Log in to reply

Thoughts on how we can prove uniqueness of the answer?

Calvin Lin Staff - 4 years, 9 months ago

Thoughts on how to come up with those numbers would help.

Francis Kong - 3 years, 7 months ago

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

Manojkumar P - 2 years, 11 months ago

 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
import itertools
from eulerlib import primes
p = primes(36)
from collections import *
c,n,v=3,[],36
l=[]
v2=set()
v3={}
v4=defaultdict(int)
def comb():
    for k in range(c):
        for i in itertools.combinations(l,c-k):
            s=sum(i)
            if s<=v and s not in v2:
                v2.add(s)
                v3[s]=i
                for j in i:
                    v4[j]+=1
for i in range(1,v+1):
    if i in v2:continue
    z=i-(i in p) if i!=24 else 14
    l.extend([z]*3)
    comb()

print(l[::3])

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

Manojkumar P - 2 years, 11 months ago

But how will you make 36?? The three highest denominations add up to 35....

Yatin Khanna - 5 years, 1 month ago

Log in to reply

2x 15 + 1x 6.

Matt Denham - 5 years ago

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.

Yatin Khanna - 5 years ago
Manojkumar P
Apr 9, 2016

1,3,9,27 - minimum denominations

powers of 3

Ans = 40

Moderator note:

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

Soumya Chakraborty - 5 years, 1 month ago

Log in to reply

Why taking back is not allowed.Is it mention in question?

Manojkumar P - 5 years, 1 month ago

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

Soumya Chakraborty - 4 years, 9 months ago

How do you do 8 with 3 coins ?

damien G - 5 years, 2 months ago

Log in to reply

Giving 9 rupee coin and the seller give 1 rupee coin

Manojkumar P - 5 years, 2 months ago

And how do you make 14 without using all four?

Yatin Khanna - 5 years, 1 month ago

Log in to reply

I give one ( 3 \leq3 )coin (27) and the seller give three ( 3 \leq3 ) coin (1,3,9) 27-1-3-9=14

Manojkumar P - 5 years, 1 month ago

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.....

Yatin Khanna - 5 years, 1 month ago

Log in to reply

@Yatin Khanna @Yatin Khanna Yep,edited

Manojkumar P - 4 years, 9 months ago
Carsten Meyer
Sep 18, 2019

Definition: Let c , d c,\:d be the number of coins and denominations, and v ( { c } ) v(\{c\}) the number of different values using exactly c c coins.

Recall some combinatorics:

Theorem: If we choose k k unordered elements from a set of n n distinct elements with repetitions, there are ( k + n 1 n 1 ) \binom{k+n-1}{n-1} possible choices.

First we show there can be no solution with d < 5 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 } ) ( c + d 1 d 1 ) , v ( { 1 c c m a x } ) c = 1 c m a x ( c + d 1 d 1 ) = c = 0 c m a x ( c + d 1 d 1 ) 1 = ( c m a x + d d ) 1 \begin{aligned} v(\{c\})&\leq\binom{c+d-1}{d-1},&&&& v(\{1\leq c\leq c_{max}\})&\leq\sum_{c=1}^{c_{max}}\binom{c+d-1}{d-1}=\sum_{c=0}^{c_{max}}\binom{c+d-1}{d-1}-1=\binom{c_{max}+d}{d}-1 \end{aligned}

Plug in c m a x = 3 c_{max}=3 to get v ( { 1 c 3 } ) ( d + 3 ) ( d + 2 ) ( d + 1 ) 6 1 34 < 36 for any 1 q 4 v(\{1\leq c\leq 3\})\leq\frac{(d+3)(d+2)(d+1)}{6}-1\leq 34<36\quad\text{for any}\quad 1\leq q\leq 4

One can obtain (at most) 34 distinct values with four or less coins. Any minimal solution must have (at least) d = 5 d=5 denominations!


Check all denominations with d = 5 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 ; 14 ; 15 ) 1 + 4 + 6 + 14 + 15 = 40 (1;\:4;\:6;\:14;\:15)\quad\Rightarrow\quad 1+4+6+14+15=\boxed{40}

 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
/* 
    in each iteration, adds one monomial to p such that the next polynomial
    has greater degree and p^3 has less vanishing coefficients of order <= N

    inputs:
        iter: iteration depth = number of coins left to choose
        p: current polynomial in x, should have coefficients in {0; 1}
        N: max degree p may have
        degree: current degree of p

    outputs:
        all polynomials p such that p^3 has no vanishing coefficients of order <= N
*/

iteration(iter, N, p, degree) := block([i, coeff, d, q],
    q : expand(p**3),
    coeff : makelist(coeff(q, x, k), k, 0, N),
    if not member(0, coeff) then (display(p), return(0)),
    if(iter <= 0) then return(0),

    /* find first non-zero coefficient in q=p^3 */
    d : 0,
    for c in coeff do
        if(c = 0) then return(0) else d : d + 1,

    if (d > N) then return(0),
    for i : degree+1 thru d do iteration(iter-1, N, p+x**i, i)
)$

iteration(5, 36, 1, 0)$

Charuka Bandara
Jul 26, 2016
  • I think the answer must be modified. we can make numbers from 1 to 36 using 1,2,4,10,17
  • 1=1
  • 2=2
  • 3=1+2
  • 4=4
  • 5=4+1
  • 6=4+2
  • 7=4+3
  • 8=4+4
  • 9=4+4+1
  • 10=10
  • 11=10+1
  • 12=10+2
  • 13=10+2+1
  • 14=10+4
  • 15=10+4+1
  • 16=10+4+2
  • 17=17
  • 18=17+1
  • 19=17+2
  • 20=17+2+1
  • 21=17+4
  • 22=17+4+1
  • 23=17+4+2
  • 24=10+10+4
  • 25=10+17-2
  • 26=10+17-1
  • 27=10+17
  • 28=10+17+1
  • 29=10+17+2
  • 30=10+10+10
  • 31=17+10+4
  • 32=17+17-2
  • 33=17+17-1
  • 34=17+17
  • 35=17+17+1
  • 36=17+17+2
  • So the answer must be 34

Moderator note:

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.

Calvin Lin Staff - 4 years, 9 months ago

Is there any 'mathematical' way to get the solution? (I did bf in python)

J T - 2 years ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...