|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
hi everybody
here's a puzzle i came accross you have 40 kg of iron and you are supposed to mould it to make 4 weights so that you can weigh any weight from 1 kg to 40 kg(integral). find the 4 weights and also tell me how u find that.
__________________
IMHO
|
|
#2
|
||||
|
||||
|
Did a google search on that. Found it on the Mathemagic website?
I don't get it. If you use what the hint gives you, weights 1 and 3kg, then can someone please explain to me how you can find out if something weights exactly 2kg in only one weighing? For it to be 2 it must be greater that and not equal to 1kg and less than but not equal to 3kg, thats two measures... Last edited by obi_wonton : July 14th, 2004 at 01:52 PM. |
|
#3
|
||||
|
||||
|
Heh, I figured out how it works. At first, I thought it'd be impossible. Then I remembered we're dealing with a balance scale and the weights can be placed on either side.
ie: side1: sample+1kg side2: 3kg (2kg sample) Since this is possibly a homework assignment, I'm not saying the answer, just that hint.
__________________
"Science is constructed of facts as a house is of stones. But a collection of facts is no more a science than a heap of stones is a house." - Henri Poincare |
|
#4
|
||||
|
||||
|
Heh, I didn't realize someone posted before me. I had the "reply to thread" screen open for a while when I figured it out. Funny I should use the same weights as the example they gave.
Boy, this is a really interesting programming challange. I'm writting a program to brute force find the 4 weights that return the largest range of weights. It seems easy, but harder to program then it looks. I'd like to see some other people's attempts at this kind of program. ie: 3,5,7: Because there's more then one solution in some case, it means the numbers aren't optimal. weight=side1:side2 1=7:3+5 2=3:5 or 5:7 3=0:3 4=3:7 5=0:5 or 5:3+7 7=0:7 9=3:5+7 10=0:3+7 15=0:3+5+7 |
|
#5
|
|||
|
|||
|
i know the answer but don't know how to get there.
|
|
#6
|
||||
|
||||
|
Quote:
How did you figure out the answer then? Just keep trying a bunch of different numbers? |
|
#7
|
||||
|
||||
|
I bet he used a little bit of Google magic :-)
I missed the part about the scale, now I see how you can do it all at one time. Two sides on a scale, right... Thanks for that. |
|
#8
|
||||
|
||||
|
Nice little puzzle! I did it by manual brute force and have written a little C code to find the value of weights needed. Now i'm trying to write it so you can give the total weight and number of weights allowed and it'll find the amounts needed. Not so easy! When it works i'll let you know!
__________________
Never trust a man who, when left alone in a room with a tea cosy, doesn't try it on. - Billy Connolly |
|
#9
|
|||
|
|||
|
I figured it out in a few minutes by logical induction + a little trial and error, and once I found the answer I realised it was obvious for a different reason.
I will hang off posting my answer so as to not spoil it for others. However here is a clue for the "obvious" answer: think of every weight as having one of three possible values for a weighing - not participating (0), on the left balance(1), or on the right balance(2). Dave - The Developers' Coach |
|
#10
|
||||
|
||||
|
Quote:
Dang. Why didn't I write my code with that in mind? I went through each combination for one side, removed the used weights from my list, then added them to the other side. Then called it recursivly. Yeah, your way's easier. I guess I wasn't thinking. DUH! ![]() |
|
#11
|
|||
|
|||
|
SPOILER: this post contains the solution. Do not read if you want to solve it yourself.
Here was my reasoning... (I will use grammes instead of kilogrammes for this, since my back is killing me). I turned it around and asked how far could you weigh up to if you had N weights. If you only had 1 weight then you could only go up to 1. If you added a second weight then you could weigh up to 4g, so the second weight would weigh 3g. I then realised that to get the next weight you need to add up the weights you have so far, double it and add 1. So the next weight would be 9, and the one after 27. Guess what - 1+3+9+27 = 40. Bingo. The weights are also the powers of 3, which was my "obvious" second answer - since the weights can have three values they form a number system in base 3. None of this probably makes sense to anyone else, but it is more or less the thought processes I went through to get the answer. Dave - The Developers' Coach |
|
#12
|
|||
|
|||
|
Quote:
i didn't quite get that. what if i take the second weight to be 2g(or any other weight) instead of 3g! ![]() |
|
#13
|
||||
|
||||
|
Quote:
Breakdown: 3 weights: 1,3,9 sample is in left tray sample weight=left side weight:right side weight 1=0:1 2=3:1 3=0:3 4=0:1+3 5=1+3:9 6=3:9 7=3:1+9 8=1:9 9=0:9 10=0:1+9 11=1:3+9 12=0:3+9 13=0:1+3+9 As a side note. There's a sci-fi book I read where some alien kids are trying to learn to use human numbers. They complained that they have to keep the numbers in the right order or it changes the value. I always wondered how their numbering system worked, but I suppose it could work something like the above. ie: 0:3+1+9 = 0:9+3+1 (13) |
|
#14
|
|||
|
|||
|
Quote:
If you took the weight to be 2g, then you could only weigh up to a maximum of 3g, and you would have two ways of weighing 1g: using the 1g weight or using 2g-1g. If you took the weight to be 4g (or more) then you could only weight 1g, 3g(4g-1g), 4g, 5g(4g+1g). There would be a gap in the sequence since you would not be able to weight 2g. Only 3g allows you to weigh all the values in exactly one way and with no gaps. Dave |
|
#15
|
|||
|
|||
|
ok, i get that.
but is your method general? , i mean that if we have a similar problem with different total weight and different number of weights to be created, how can we find that. eg: 50 kg and 5 weights and can your method tell the minimum number of weights that must be created so that we can weigh all the weights in the range. eg: 50 kg and 4 weights may not be a possible combination. |