File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

six coins

 
Arjun Shastry
Ranch Hand
Posts: 1893
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are 6 coins. Two are counterfeit and are lighter than genuine ones.In 3 weighings, you need to find counterfeit coins.
 
Saurabh Pillai
Ranch Hand
Posts: 524
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think question is open ended and allows to speculate.

There are six coins with 2 lighter coins. Considering 2gm as genuine and 1gm as counterfeit. 2,2,2,2,1,1

Divide them into two groups and weigh them. Two possibilities
1) They weigh unequal i.e. one group is heavier than other.
2) They weigh equal. A) 2,2,1 B) 2,2,1

First let's consider case 1 and groups were A1) 2,2,2 and B1) 2,1,1.

Now pick one coin from group A1 and mix with group B1 and again divide them in two groups.

Same possibility again,

1) They weigh unequal 2) They weigh equal

Consider they weigh unequal, A2) 2,2 B2) 1,1

The lighter group contains those two lighter coins.

Now, if you consider the second case i.e they weigh equal. A21) 1,2 B21) 1,2

Now, swipe two coins. There are two possibilities here You swipe 1)equally weighing 1 with 1 or 2 with 2 2) Unequally weighing 1 with 2 or 2 with 1

1) If you swipe unequally weighing coins and then weigh again you would find the lighter side as those two lighter coins. This is in 3 weighs only, but
2) If you swipe equally weighing coins then , you need to remember those two coins and separate them out and weigh with another two coins , and the lighter side is two lighter coins. This take 4 weighing.

I am leaving rest of the cases as homework.

(Did I take correct route?)





 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12015
24
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


if you weigh 3 against three, and one side is lighter, you only need two weighings.

Both of the fake coins are in the lighter side.

take two from that side, and weigh them against each other. If they are equal, then those are the two counterfeit coins.

If they are unequal, the lighter one is counterfeit, as is the third, unweighed one.

[edit - corrected typo]
 
Saurabh Pillai
Ranch Hand
Posts: 524
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saurabh Pillai wrote:(Did I take correct route?)


After looking at Fred's answer I did take wrong route. Thanks Fred.
 
kri shan
Ranch Hand
Posts: 1453
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you weigh 3 against three, and one side is lighter, you only need two weighings.

Both of the fake coins are in the lighter side.


If one fake coin is one side and another fake coin is another side during my first weighing
like (2 original coins + 1 fake coin one side and 2 original coins + 1 fake coin another side).
Then can we start from begining ?
 
Mike Simmons
Ranch Hand
Posts: 3028
10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kri shan wrote:If one fake coin is one side and another fake coin is another side during my first weighing
like (2 original coins + 1 fake coin one side and 2 original coins + 1 fake coin another side).
Then can we start from begining ?

No need. Because the first weighing balances, you now know that there exactly one counterfeit on each side. There is a way to find both of these, using just two weighings.
 
Arjun Shastry
Ranch Hand
Posts: 1893
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all.My approach was- coins A,B,C,D,E,F(Lighter coins need not be of same weight).
First compare A---B--If they weigh same, then C and D. If they too weigh same, then compare A and C.If A and C are same, then E and F are lighetr coins.
if A and B don't weigh same, then its simple.
 
Henrique Ordine
Ranch Hand
Posts: 128
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a lot more than 3 weighings.
 
Stefan Evans
Bartender
Posts: 1640
9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henrique Ordine wrote:That's a lot more than 3 weighings.

Oh really?

1: A-B
2: C-D

If we have identified two coins as lighter, we are done (e.g. A<B and C<D).

If we have identified one coin as lighter
3: E-F to find the 'other" lighter coin.

Otherwise (all scales balanced to date):
3: A-C

If balanced, then the two 'lighter' coins are E,F
If A<C, then the coins are A,B
otherwise the coins are C,D

That is only 3 weighings
 
Henrique Ordine
Ranch Hand
Posts: 128
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice try.

1:A
2:B
3:C
4

I stopped counting after that.
 
Henry Wong
author
Marshal
Pie
Posts: 20829
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henrique Ordine wrote:Nice try.

I stopped counting after that.


Don't know what you mean. The solution looks like at most 3 weighings to me.

Henry
 
Mike Simmons
Ranch Hand
Posts: 3028
10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henrique Ordine wrote:Nice try.

1:A
2:B
3:C
4

I stopped counting after that.

Henrique: I think you're imagining a "weighing" differently than we are. That's probably because most of us have read similar problems to this, and we are assuming a detail which was not actually specified: the weighings are performed with a balance, in which you put as many things as you want on one side, and as many as you want on the other, and then you find out which side is heavier. (Or perhaps they balance, being equally heavy.) That's one weighing.
 
Henrique Ordine
Ranch Hand
Posts: 128
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, thát kind of balance. Yes, makes sense, sorry about that.
 
Ryan McGuire
Ranch Hand
Posts: 1048
4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a twist on this puzzle: Can you come up with three predetermined weighings that will lead to the answer? i.e. You don't get to use the results of one weighing to determine which coins to weigh next.

I don't know if there is a solution, but how hard can it be?
 
Henrique Ordine
Ranch Hand
Posts: 128
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I still have doubts about the last solution to the previous problem.

Are they assuming that if A<B then A is one of the lighter coins and B is not? If so, they said that the lighter coins don't necessarily need to have the same weight, so how do you know that they're not both the lighter coins. <br /> <br /> Also, are they assuming that if then they must be both original coins? If so, how do they know that they're not both lighter coins that coincidentally weigh the same weight?>
 
Ryan McGuire
Ranch Hand
Posts: 1048
4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henrique Ordine wrote:I still have doubts about the last solution to the previous problem.

Are they assuming that if A<B then A is one of the lighter coins and B is not? If so, they said that the lighter coins don't necessarily need to have the same weight, so how do you know that they're not both the lighter coins. <br /> <br /> Also, are they assuming that if then they must be both original coins? If so, how do they know that they're not both lighter coins that coincidentally weigh the same weight?>


Yes, I do believe that even though it wasn't in the original problem statement we are assuming that both counterfeit coins are light by the same amount. Therefore, is A<B then A must be counterfeit and B must be real. <br /> <br /> >
 
Mike Simmons
Ranch Hand
Posts: 3028
10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, Arjun's solution does not require the assumption that both counterfeits have the same weight.

If A < B, A is definitely counterfeit, and B is unknown.

From Stefan's description:
1: A-B
2: C-D

If we have identified two coins as lighter, we are done (e.g. A < B and C < D).

Meaning if both weighings are unbalanced, we have definitely identified two lighter coins, and those are the two counterfeits.

If we have identified one coin as lighter
3: E-F to find the 'other" lighter coin.

What was unstated here is that if E-F balance, that means that the second counterfeit must be in the first four. If only one of those two weighings was unbalanced, then the second counterfeit must be the heavier coin there. It was the coin we weren't sure about at first - now we know it must be counterfeit.

Otherwise (all scales balanced to date):
3: A-C

If balanced, then the two 'lighter' coins are E,F
If A<C, then the coins are A,B
otherwise the coins are C,D

This part works as stated.
 
anirudh jagithyala
Ranch Hand
Posts: 41
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I analysed all possible ways and came up withe following logic

For every time we weigh we have 3 possible outcomes either equals, greater than or less than


consider the four coins as a,b,c,d,e,f
make three groups of two each say ab,cd,ef

Now there are two possibilities both the defective are in same group or the defectives are in different groups.


i gave all symbols in small letters ,, sorry for that.......


as there are 2 fake coins in 6 coins these can have (6*5)/2=15 outcomes {Permutations and combinations}
I tried to get all the combination of 15 outcomes with the above analyses........

Hope this helps...


 
Eugene Rabii
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That was simpler then I first read it But still fun.

1. A and B, then C and D and then... well yes it get obvious really fast.

Cheers,
Eugene.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic