Jump to content
BrainDen.com - Brain Teasers
  • 0


Guest
 Share

Question

Here we have 4 types of coins, 1 2 5 and 10 value coins, you can make any value you want out of different combination of coins...

The combination with the maximum number of coins for value A is obviously A coins (all 1's)

The combination with the minimum number of coins for value A is floor(A/10)+floor((a%10)/5)+floor((a%5)/2)+(a%5)%2 (as in first you start with 10's, then a 5, then one or two 2's then a 1)

We want values that you can make them out of combination of all possible coin numbers from the min to the max, for example value 7 you can make it:

7 Coins: 1 1 1 1 1 1 1 (MAX)

6 Coins: 1 1 1 1 1 2

5 Coins: 1 1 1 2 2

4 Coins: 1 2 2 2

3 Coins: 5 1 1

2 Coins: 5 2 (MIN)

But for instance for value 15, the min is 2 and the max is 15 but you can't make it out of a 4 coin combo.

1. Find the smallest value that is larger than 20 that meets our requirement...

2. What is a general representation of the numbers that meet the requirements...

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Here we have 4 types of coins, 1 2 5 and 10 value coins, you can make any value you want out of different combination of coins...

The combination with the maximum number of coins for value A is obviously A coins (all 1's)

The combination with the minimum number of coins for value A is floor(A/10)+floor((a%10)/5)+floor((a%5)/2)+(a%5)%2 (as in first you start with 10's, then a 5, then one or two 2's then a 1)

We want values that you can make them out of combination of all possible coin numbers from the min to the max, for example value 7 you can make it:

7 Coins: 1 1 1 1 1 1 1 (MAX)

6 Coins: 1 1 1 1 1 2

5 Coins: 1 1 1 2 2

4 Coins: 1 2 2 2

3 Coins: 5 1 1

2 Coins: 5 2 (MIN)

But for instance for value 15, the min is 2 and the max is 15 but you can't make it out of a 4 coin combo.

1. Find the smallest value that is larger than 20 that meets our requirement...

2. What is a general representation of the numbers that meet the requirements...

You can make 15 out of the four coins: 10 2 2 1.

Link to comment
Share on other sites

  • 0

Let the number be X.

Notation:

Length : (Num 1's, Num 2's, Num 5's, Num 10's)

The maximum length of coin representations is

X : (X, 0, 0, 0)

Can get to other representations by adding the vectors:

(-2,1,0,0): Length -= 1

(-5,0,1,0): Length -= 4

(-10,0,0,1): Length -= 9

(0,-5,2,0): Length -= 3

(0,-5,0,1): Length -= 4

(0,0,-2,1): Length -= 1

All elements of the current count vector must be non-negative.

If X mod 2 = 0, then

All lengths from X/2 to X can be represented by adding (-2,1,0,0).

If X mod 2 = 1, then

All lengths from (X+1)/2 to X can be represented by adding(-2,1,0,0) to (X,0,0,0)

Alternatively,

For n = 0 to floor(X/2)

X-n can be represented via adding (-2,1,0,0) to (X,0,0,0)

Similarly,

For n = 0 to floor(X/5)

X-4n can be represented via adding (-5,0,1,0) to (X,0,0,0)

For n = 0 to floor(X/10)

X-9n can be represented via adding (-10,0,0,1) to (X,0,0,0)

If X mod 2 = a

For n = 0 to floor(X/10)

(X+a)/2-3n can be represented via adding n*(0,-5,2,0) to (a,(X-a)/2,0,0)

If X mod 2 = a

For n = 0 to floor(X/10)

(X+a)/2-4n can be represented via adding n*(0,-5,0,1) to (a,(X-a)/2,0,0)

If X mod 5 = a

For n = 0 to floor(X/10)

(X+4a)/5-n can be represented via adding n*(0,0,-2,1) to (a,0,(X-a)/5,0)

I'm too tired to think more about this, so I'll end with the following as my result for now:

(-2,1,0,0): Length -= 1

(-5,0,1,0): Length -= 4

(-10,0,0,1): Length -= 9

(0,-5,2,0): Length -= 3

(0,-5,0,1): Length -= 4

(0,0,-2,1): Length -= 1

Link to comment
Share on other sites

  • 0

The answer to 2. is: every positive integer

except 5 and 10. Here's the proof:

Let N be the amount we are trying to make from

the 1, 2, 5, and 10 coins. Suppose we can make

N with n coins. We will show how to use this

to make N with n+1 coins (except in 2 instances).

Step 1:

If there is a 10 in the n coins, we can replace

any single instance of a 10 with 5 and 5, thereby

making N with n+1 coins. So, we can eliminate

all the instances of 10s one at a time, each time

incresing the number of coins by 1.

Step 2:

So, now that we got rid of all the 10s, we only

have 5s, 2s, and 1s left. Similar to what we

did with the 10s, we can eliminate all instances

of 2s (with 1 and 1) one at a time, each time

increasing the number of coins by 1.

Step 3:

Now, we have only 5s and 1s left. If there is

at least one 1, we can get rid of all the 5s:

Replace any 5 and a 1 by 2 2 2. We got rid

of one five while increasing the coin count

by 1. Now we can get rid of the 2s (with 1 1)

one at a time, each time increasing the coin

count by 1. That 2 2 2 we converted at the

beginning of this step is now six 1s. We now

have more 1s, and we can repeat Step 3, getting

rid of all the 5s while creating more 1s.

The only time these steps do not eventually

get to N 1s, is when, at some point, we have

nothing but 5s. But wait! If we have three

or more 5s, we can turn 5 5 5 into 10 2 2 1,

then 10 2 2 1 into 5 5 2 2 1 into 5 5 2 1 1 1

into 5 5 1 1 1 1 1, then, using Step 3, we

can get rid of all the fives.

So, the only time we are stuck is when we have

one or two 5s and nothing else.

Hence, the answer to part 2 is: Every positive

integer with the exception of 5 and 10.

Link to comment
Share on other sites

  • 0

21- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 (Max)

20- 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1

19- 2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1

18- 2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1

17- 5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1

16- 5,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1

15- 5,2,2,1,1,1,1,1,1,1,1,1,1,1,1

14- 5,2,2,2,1,1,1,1,1,1,1,1,1,1

13- 5,5,1,1,1,1,1,1,1,1,1,1,1

12-10,1,1,1,1,1,1,1,1,1,1,1 or 5,5,2,1,1,1,1,1,1,1,1,1

11-10,2,1,1,1,1,1,1,1,1,1 or 5,5,2,2,1,1,1,1,1,1,1

10-10,2,2,1,1,1,1,1,1,1 or 5,5,2,2,2,1,1,1,1,1

09-10.2.2.2.1.1.1.1.1 or 5,5,5,1,1,1,1,1,1

08-10,5,1,1,1,1,1,1 or 5,5,5,2,1,1,1,1

07-10,5,2,1,1,1,1 or 5,5,5,2,2,1,1

06-10,5,2,2,1,1 or 5,5,5,2,2,2

05-10,5,2,2,2 or 5,5,5,5,1

04-10,5,5,1

03-10,10,1

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...