Puzzle time - Hazards of Electronic Coin Flipping
-
I think this algorithm would yield the solution in principle (but is probably too expensive to actually compute):
Take all 2^10 = 1024 sequences of coin flips. Calculate its probability symbolically (which yields a polynomial of degree 10 in p).
Now iterate over all possible partitions of the set of sequences of coin flips into three disjoint sets. Compute the symbolic probability of each subset and generate an equation that that probability must be 1/3. Attempt to find a real-valued p that solves the three equations. If that fails, continue with the next possible partition.
-
I have a solution that solves it sometimes but not always.
Set it to 1/3, use that to select/eliminate one player, then use von Neumann’s algorithm for getting a fair toss from a biased coin to select between the survivors.
But that can take arbitrarily long so isn’t really a solution.
-
Oh, I just see that I messed up the parenthesis and read " p(HHHH or TTTT) = 1/3 " as " p(HHHH) = 1/3 or p(TTTT) = 1/3".
Your equation does have two solutions in the real numbers, p = 0.24213 and p=0.75787.
The question is whether any subset of the other combinations sums up to 0.5.
-
Played around a little with your hints.
With p as about 0.24213 and 4 tosses, there are 120 out of 65536 possible combinations that are pretty close to 0.5.
For instance,
HTTT,THHH,THTH,THTT,TTHH,TTHT,TTTH
sums up to 0.49969773.I'm not quite sure whether the deviation from 0.5 is due to rounding errors or whether it's actually only close to 0.5.
I'm sure there's a better way to do this...
-
As long as we’re using an even power (4 in this case, but 6,8,10 should work if there’s a real solution to the equation that gives 1/3) the symmetry of the remaining flip combinations guarantees they can be split into groups of equal probability. Thus we have multiple solutions that give three equal outcomes, in as few as 4 flips.
-
SOLUTION: If you could set p twice, two flips would be enough: Set p = 1/3 and on Heads give the widget to Alice, else reset to 1/2 and use the result to decide between Bob and Charlie. Since you can only set p once, it might make sense to try to design a scheme first, then pick p to make the scheme work.
For example, you could flip your coin three times and if the flips are not all the same, you could use the "different" flip to decide to whom to award the widget (e.g., "HTT" means Alice gets it). But if you get all heads or all tails, you'll have to do it again, and maybe yet again — so, it might take more than 10 flips.
But now suppose we flip the coin four times. There are four ways to get one head, six to get two, four to get three: Even numbers all, so anytime you get non-uniform results you can use the flips to decide between Alice and Bob. If the coin is fair, the remaining probability — that is, the probability q = p4 + (1 - p)4 of "HHHH or TTTT" — is only 1/8, too small for Charlie.
As you reduce p, however, q changes continuously and approaches 1. Thus, by the Intermediate Value Theorem, there is some p for which the probability of "HHHH or TTTT" is exactly the 1/3 you need.
[The actual value of p works out to 1/2 − sqrt(sqrt(2/3)−3/4), which is about 0.24213069021. The "other root," p = 1 − 0.24213069021, also works. Since these numbers are close to 1/4 and 3/4, you could do a pretty good job with 8 flips of a fair coin; think of each pair of 50-50 flips as one flip of a p-coin, e.g., HH is interpreted as H and HT or TH or TT as T. The result is "fair" between Alice and Bob but gives the widget to Charlie with probability (1/4)4 + (3/4)4 = 0.3203125, a bit short of his just desserts.]