Comments on: Yoak: Will A Real Gold Coin Please Stand Up? http://mathfactor.uark.edu/2009/03/yoak-will-a-real-gold-coin-please-stand-up/ The Math Factor Podcast Site Fri, 08 Aug 2014 12:52:06 +0000 hourly 1 https://wordpress.org/?v=4.9.25 By: Parallel Minded http://mathfactor.uark.edu/2009/03/yoak-will-a-real-gold-coin-please-stand-up/comment-page-1/#comment-1066 Tue, 29 Jan 2013 18:34:08 +0000 http://mathfactor.uark.edu/?p=515#comment-1066 Stephen: Ah, nice!  I hadn’t noticed that [spoiler]
the 3rd and 4th rounds work fine even for groups of a single coin, because you can group the comparisons like this:

Round 3:
1 3
2 4
5 7
6 8

Round 4:
3 5
4 6
7 9
8 10

[/spoiler]

The last question you ask is interesting, it’s like sorting algorithms where all the comparisons need to be specified ahead of time: Sorting Networks.

But I think it has a rather different answer… [spoiler]
You need to compare every possible pair of coins.

If there are any two coins A and B which are not compared with each other, then suppose all other coins (call them “class C coins”) are equal to each other but unequal to A or B. In this case you cannot know whether A and B are the same or not.
[/spoiler]
Would it help if you are told there is at least one of each type of coin?

]]>
By: Stephen Morris http://mathfactor.uark.edu/2009/03/yoak-will-a-real-gold-coin-please-stand-up/comment-page-1/#comment-1064 Fri, 18 Jan 2013 23:48:00 +0000 http://mathfactor.uark.edu/?p=515#comment-1064 Parallel Minded: Yes, you make a good point, why would you be concerned about the number of passes if each pair is compared sequentially?  Unless the coins were affected by the machine maybe?  Seems unlikely.  For the record the problem talked about a machine that took two coins at a time but I agree that then we should be looking at the number of comparisons. Now for your question, [spoiler] I think straus already answered it with four passes.  Arrange the coins in a circle.  Use two passes to compare each coin with it’s immediate neighbours.  We now have contiguous groups of like coins, each group known to be different to the neighbouring groups.  We use two more passes to compare each group to the groups which are one away.  Label one group as A and work clockwise.  The next group we label B.  Going round the circle we can identify each group as A, B or C.[/spoiler]  It’s a fun part of these types of puzzles to try different variations and see what difference they make to the answer.  One obvious change is to get rid of passes altogether and just think about how many pairs we should compare.  Or we could look at the average number of comparisons, rather than the maximum.   In my answer above I have assumed we can take knowledge from one pass and use it to define the next pass, but what if we can’t?  What if we must define the comparisons in each pass before we start? (maybe this was your intention) I don’t know the answer to these questions! 

]]>
By: Parallel Minded http://mathfactor.uark.edu/2009/03/yoak-will-a-real-gold-coin-please-stand-up/comment-page-1/#comment-1062 Thu, 17 Jan 2013 15:33:24 +0000 http://mathfactor.uark.edu/?p=515#comment-1062 Stephen’s 2-pass solution, and his 4-pass extension of Jeff’s solution, depend on a loophole in the problem statement.  Jeff’s 3-pass solution does not use the loophole.

The problem statement refers to “passes”, for which certain properties are listed (sounding like clarifications rather than an exhaustive list of properties). A very natural unlisted property for a pass would be that the comparisons in a pass are essentially simultaneous, so in particular you cannot use results from the “first part” of a pass to decide what coins to compare “later” in that same pass.  This property is natural if you think of a pass as being done in one step on a parallel computer, and of course you want to minimize the number of passes because comparisons take a long time and you want to minimize the time of the parallel algorithm.  Indeed, without this property, it seems much less natural to want to try to minimize the number of passes.  (Do you have a data structure that decays each time it gets compared?)

(If I were to ask this question in an interview, and the applicant used this loophole, I would ask them for an example of when their interpretation could be relevant!)

In any event, Stephen’s nice and tight analysis prompts the non-loophole version of the same question:

How many parallel passes does it take to separate all the coins by type into three piles?

]]>
By: lunaticg http://mathfactor.uark.edu/2009/03/yoak-will-a-real-gold-coin-please-stand-up/comment-page-1/#comment-702 Mon, 11 Jan 2010 03:17:16 +0000 http://mathfactor.uark.edu/?p=515#comment-702 What is the answer or solutions?
I am not very good at math but this sound interesting.

]]>
By: american eagle gold coin http://mathfactor.uark.edu/2009/03/yoak-will-a-real-gold-coin-please-stand-up/comment-page-1/#comment-701 Sun, 03 Jan 2010 00:40:56 +0000 http://mathfactor.uark.edu/?p=515#comment-701 I would take a bite out of it . otherwise this puzzle is very confusing i must say

]]>
By: gold coins http://mathfactor.uark.edu/2009/03/yoak-will-a-real-gold-coin-please-stand-up/comment-page-1/#comment-700 Fri, 01 Jan 2010 08:10:51 +0000 http://mathfactor.uark.edu/?p=515#comment-700 This puzzle is very confusing if you can touch the coin you can tell by the weight.   The gold coins will always be the heaviest.  The gold coin should look different to the others so maybe that would be the best way to distinguish them.

]]>
By: jyoak http://mathfactor.uark.edu/2009/03/yoak-will-a-real-gold-coin-please-stand-up/comment-page-1/#comment-603 Fri, 18 Sep 2009 17:11:26 +0000 http://mathfactor.uark.edu/?p=515#comment-603 Phil,

I don’t see the objection.  Could you provide specifics?  Perhaps lay out the five coins in order assuming you match from left to right.  For instance, one combination is:

GGSSG which has the two matches.  You’d match the first two and retain.  You’d match the second two and retain.  And you always retain the odds.  So you have a majority of gold.

To finish the algorithm, you’d then match pair one (GG) to pair two (SS) and they don’t match so you’d discard them.  At this point, you have one coin and you know it is gold because in removing you removed at least as many non-gold as gold and you started witha  gold majority.

I know this doesn’t necessarily ansswer your objection as you may have a different ordering in mind.  Show us how.

]]>
By: Phil Ryan http://mathfactor.uark.edu/2009/03/yoak-will-a-real-gold-coin-please-stand-up/comment-page-1/#comment-602 Fri, 18 Sep 2009 15:30:31 +0000 http://mathfactor.uark.edu/?p=515#comment-602 A slight problem with the 2 pass solution, if you have an odd number of coins then you are not guarenteed to have more than 50% gold coins after 1st pass. Eg if have 5 coins, 3 of them gold, 2 silver- what happens after your 1st pass with 2 matches?

]]>
By: czarandy http://mathfactor.uark.edu/2009/03/yoak-will-a-real-gold-coin-please-stand-up/comment-page-1/#comment-496 Tue, 21 Apr 2009 02:41:13 +0000 http://mathfactor.uark.edu/?p=515#comment-496 A variant of this is that you can make arbitrary comparisons and want to minimize their number. This is basically the “majority element” problem.

In the worst case, I believe you need n-1 comparisons (for n elements).

You could also do the standard probabilistic approach:
1. Pick C random coins (with replacement).
2. Find the majority among them.
3. Output that as the answer.

Unfortunately if you have just slightly more than half of one type and just slightly less than half of the other, this doesn’t work so well. But if you know that there is a fixed proportion of the gold coins (e.g., 50.01%) then you only need to make a *constant* number of comparisons.

]]>
By: jyoak http://mathfactor.uark.edu/2009/03/yoak-will-a-real-gold-coin-please-stand-up/comment-page-1/#comment-484 Thu, 02 Apr 2009 18:08:41 +0000 http://mathfactor.uark.edu/?p=515#comment-484 Stephen, It isn’t original and I don’t know the source.  Puzzles of this sort are common as interview questions for computer programmers and the culture tends to appreciate them and continue to pass them around.  This is one such I heard around the water cooler of a programming shop. Another such puzzle that’s been on the site before was in DX.  http://mathfactor.uark.edu/2008/05/13/dx-dumb-robots/  This one is anecdotally ascribed to originating from a Microsoft interview question, though I don’t have strong evidence of that.

]]>