- Post Reply Bookmark Topic Watch Topic
- New Topic

programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
all forums

this forum made possible by our volunteer staff, including ...

Marshals:

- Campbell Ritchie
- Liutauras Vilda
- Jeanne Boyarsky
- Devaka Cooray
- Paul Clapham

Sheriffs:

- Tim Cooke
- Knute Snortum
- Bear Bibeault

Saloon Keepers:

- Ron McLeod
- Tim Moores
- Stephan van Hulst
- Piet Souris
- Ganesh Patekar

Bartenders:

- Frits Walraven
- Carey Brown
- Tim Holloway

posted 8 years ago

There are 6 coins. Two are counterfeit and are lighter than genuine ones.In 3 weighings, you need to find counterfeit coins.

MH

posted 8 years ago

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?)

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

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?)

posted 8 years ago

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]

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]

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors

Saurabh Pillai

Ranch Hand

Posts: 541

posted 8 years ago

After looking at Fred's answer I did take wrong route. Thanks Fred.

Saurabh Pillai wrote:(Did I take correct route?)

After looking at Fred's answer I did take wrong route. Thanks Fred.

posted 8 years ago

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 ?

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 ?

posted 8 years ago

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.

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: 1907

1

posted 8 years ago

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.

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.

MH

posted 8 years ago

That's a lot more than 3 weighings.

J2EE Architect/Developer

posted 8 years ago

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 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: 129

posted 8 years ago

Nice try.

1:A

2:B

3:C

4:D

I stopped counting after that.

1:A

2:B

3:C

4:D

I stopped counting after that.

J2EE Architect/Developer

posted 8 years ago

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

Henry

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 Foreman

Posts: 3268

19

posted 8 years ago

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 wrote:Nice try.

1:A

2:B

3:C

4:D

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: 129

posted 8 years ago

Oh, thát kind of balance. Yes, makes sense, sorry about that.

J2EE Architect/Developer

posted 8 years ago

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?

I don't know if there is a solution, but how hard can it be?

Henrique Ordine

Ranch Hand

Posts: 129

posted 8 years ago

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

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

J2EE Architect/Developer

Ryan McGuire

Ranch Hand

Posts: 1168

11

posted 8 years ago

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

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 Foreman

Posts: 3268

19

posted 8 years ago

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:

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

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.

This part works as stated.

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

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.

posted 8 years ago

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

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

posted 8 years ago

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.

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

Cheers,

Eugene.

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |

- Post Reply Bookmark Topic Watch Topic
- New Topic

Boost this thread!