<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: What are the Odds?</title>
	<atom:link href="http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/feed/" rel="self" type="application/rss+xml" />
	<link>http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/</link>
	<description>Strain your Brain</description>
	<lastBuildDate>Tue, 31 Aug 2010 17:39:33 -0700</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Dan</title>
		<link>http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/comment-page-1/#comment-11861</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Thu, 30 Oct 2008 19:37:56 +0000</pubDate>
		<guid isPermaLink="false">http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/#comment-11861</guid>
		<description>The following solutions are sorted in reverse chronological order of when I&#039;ve seen them.

#1:
This is very similar to Yair&#039;s idea, but makes certain useful assumptions: We need to assume that N is at least 4, and that Q=N-1 is a prime number, and choose K=Q. This satisfies that (Q choose C) = Q!/C!(Q-C)!, and for Q&gt;C&gt;0, since Q is prime, Q divides Q! but does not divide C! or (Q-C)!, and hence divides (Q choose C), like we wanted. We can choose the probability P such that f(P)=P^K+(1-P)^K=1/N, because f(P) is a continuous function of P, which satisfies f(1)= 1 &gt; 1/N, f(1/2)= 2*(1/2)^K = 1/2^(N-2), which is not greater than 1/N for all N at least 4. Hence by the mean value theorem, there is a P in (1/2,1) with f(P)=1/N, and we are finished.

Now we only need to understand why the assumption that N-1 is prime does not limit us: Indeed, for all N, by Dirichlet&#039;s Theorem, we know that there are infinitely many primes Q in the arithmetic sequence {m*N-1&#124; m is Natural}, and if we take one such prime that is at least 3, then by the above we have a solution for m*N=Q+1. But then if we treat each person as m different people, we have a solution for N people, and we are happy.

(By the way, such K does not necessarily exists for all N where N-1 is not prime, and in fact no such K exists when N-1 is non-prime, as the following claim is true: The greatest common divisor of all (K choose C), where C ranges from 1 to K-1, equals a prime Q iff K is a power of Q, and if K is not a prime power, it equals 1)
 
#2:
This has some similarities to #1, but is a little different. We will need to assume that N is large enough, but as shown before, small N can be reduced to the larger m*N case easily. 

Let the probability of the coin be P. We will flip the coin K=N-1 times, and write the result of the filp as a string of length K composed of letters H and T. Such a string will be called &quot;bad&quot; if it can be cyclically shifted right less than K times and it will return to itself, i.e. if it is non-trivially periodic. A string will be called &quot;good&quot; iff it is not bad. Then obviously the good strings can be divided into N-1 sets of strings, all with equal total probability, by ensuring that if one good string can be obtained from another by cyclic rotations, then they are in different sets. Now, let f(P) denote the probability of the result string being a bad string. Then we only need to be certain that it&#039;s possible to choose P such that f(P)=1/N. 

It is clear that f(P) is a polynomial of order K-1 in P, and thus continuous. If P=1, then the result string is always all heads, which has period 1 and is thus a bad string, so f(1)=1 &gt; 1/N, and we need only see that 1/N &gt; f(1/2), for example. Now, if P=1/2, then f(P) is simply the number of bad strings of length K divided by 2^K. We can count the bad strings by separating them based on their minimal period - the number of bad strings with period d equals 2^d if d is a proper divisor of K or 0 otherwise, and hence the number of bad strings with minimal period d is certainly not greater than 2^d, and 0 when d does not divide K. Hence the total number of bad strings is at most the sum of 2^d over all proper divisor d of K. The greatest proper divisor of K is of course at most K/2, hence the number of bad strings is at most the sum of 2^d over all natural d up to K/2, which is lesser than 2^((K/2)+1), and hence f(1/2) is lesser than 2^(K/2+1)/2^K=1/2^(K/2-1)=1/2^((N-3)/2). Obviously, exponential in N decreases to 0 much faster than 1/N, and so for large enough N we indeed have f(1)&gt;1/N&gt;f(1/2), as required.

#3:
This solution is somewhat long and messy, so I will leave some parts as exercise.

Denote by p the probability of heads, q the probability of tails (p+q=1), and choose them such that p*q=1/N (possible iff N is at least 4). Flip the coin a large number K of times. We will assign the results of the raffle to the results of the coin flips in such a way that if all coin flips were changed, we will choose the same person, with the exception of results with equal numbers of heads and tails (if K is even). We will then have basic &quot;building blocks&quot; with sizes of the form p^l*q^m+p^m*q^l for m+l=K, l&gt;m non-negative integers, or p^l*q^m when l=m=K/2. Using the basic relations p+q=1, pq=1/N, it is possible to partially compute the above expressions and see that they can all be represented as rational numbers with denominator N^[K/2] (where [x]=floor(x)). Furthermore we have all the following properties:

1) The integers (N^[K/2])*(p^l*q^m+p^m*q^l), or half of that for m=l, decrease as m increases, for m up to [K/2];
2) For all integers r from 0 to [K/2]-1, the integer corresponding to m=r is less than N times greater than the integer corresponding to m=r+1;
3) For all r from 0 to [K/2], there are (K choose r) appearances of the integer corresponding to m=r, and hence at least K appearances for all r from 1 to [K/2];
4) The sum of all these integers, counting multiple appearances, is of course N^[K/2] by the binomial theorem;
5) The smallest of these integers (corresponding to m=[K/2]) is exactly 1;

These properties guarantee that as long as K is at least N^2, it is possible to divide the integers above into N sets, such that each set will have sum exactly N^[K/2]-1, which once we return to the original probabilities by dividing by N^[K/2], yields exactly the wanted results.
The properties above imply this by implying something somewhat stronger: They imply that if we try dividing these integers into sets by taking at each step the largest integer not yet used, and trying to place it into a set such that it will not make its sum exceed N^[K/2]-1, we will succeed: Properties 2 and 3 and 4, together with K &gt; N^2, imply that this process will not halt before we reach the smallest integers, and properties 4 and 5 imply that the smallest integers will always fit into the sets, because they are of size 1. This concludes this long proof.


Some analysis and comparison: Solutions #1 and #2 are quite similar, and in fact are completely the same in the case that N-1 is prime. The extension to other cases is quite different though: Solution #2 is efficient in coin tossing, always requiring only N-1 tosses, but the calculation of the polynomial f(P), and thus of P, might be long and annoying. On the other hand, solution #1 always uses a simple polynomial that needs to be solved to find P, but also depends on finding a prime in the arithmetic sequence, which might be difficult and gives no simple estimation of the number of coin tosses as a function of N. Solution 3 only requires solving a quadratic in order to obtain the probability p, and only O(N^2) tosses (possibly significantly less), but actually assigning the results seems more complicated than in #1 and #2.</description>
		<content:encoded><![CDATA[<p>The following solutions are sorted in reverse chronological order of when I&#8217;ve seen them.</p>
<p>#1:<br />
This is very similar to Yair&#8217;s idea, but makes certain useful assumptions: We need to assume that N is at least 4, and that Q=N-1 is a prime number, and choose K=Q. This satisfies that (Q choose C) = Q!/C!(Q-C)!, and for Q&gt;C&gt;0, since Q is prime, Q divides Q! but does not divide C! or (Q-C)!, and hence divides (Q choose C), like we wanted. We can choose the probability P such that f(P)=P^K+(1-P)^K=1/N, because f(P) is a continuous function of P, which satisfies f(1)= 1 &gt; 1/N, f(1/2)= 2*(1/2)^K = 1/2^(N-2), which is not greater than 1/N for all N at least 4. Hence by the mean value theorem, there is a P in (1/2,1) with f(P)=1/N, and we are finished.</p>
<p>Now we only need to understand why the assumption that N-1 is prime does not limit us: Indeed, for all N, by Dirichlet&#8217;s Theorem, we know that there are infinitely many primes Q in the arithmetic sequence {m*N-1| m is Natural}, and if we take one such prime that is at least 3, then by the above we have a solution for m*N=Q+1. But then if we treat each person as m different people, we have a solution for N people, and we are happy.</p>
<p>(By the way, such K does not necessarily exists for all N where N-1 is not prime, and in fact no such K exists when N-1 is non-prime, as the following claim is true: The greatest common divisor of all (K choose C), where C ranges from 1 to K-1, equals a prime Q iff K is a power of Q, and if K is not a prime power, it equals 1)</p>
<p>#2:<br />
This has some similarities to #1, but is a little different. We will need to assume that N is large enough, but as shown before, small N can be reduced to the larger m*N case easily. </p>
<p>Let the probability of the coin be P. We will flip the coin K=N-1 times, and write the result of the filp as a string of length K composed of letters H and T. Such a string will be called &#8220;bad&#8221; if it can be cyclically shifted right less than K times and it will return to itself, i.e. if it is non-trivially periodic. A string will be called &#8220;good&#8221; iff it is not bad. Then obviously the good strings can be divided into N-1 sets of strings, all with equal total probability, by ensuring that if one good string can be obtained from another by cyclic rotations, then they are in different sets. Now, let f(P) denote the probability of the result string being a bad string. Then we only need to be certain that it&#8217;s possible to choose P such that f(P)=1/N. </p>
<p>It is clear that f(P) is a polynomial of order K-1 in P, and thus continuous. If P=1, then the result string is always all heads, which has period 1 and is thus a bad string, so f(1)=1 &gt; 1/N, and we need only see that 1/N &gt; f(1/2), for example. Now, if P=1/2, then f(P) is simply the number of bad strings of length K divided by 2^K. We can count the bad strings by separating them based on their minimal period &#8211; the number of bad strings with period d equals 2^d if d is a proper divisor of K or 0 otherwise, and hence the number of bad strings with minimal period d is certainly not greater than 2^d, and 0 when d does not divide K. Hence the total number of bad strings is at most the sum of 2^d over all proper divisor d of K. The greatest proper divisor of K is of course at most K/2, hence the number of bad strings is at most the sum of 2^d over all natural d up to K/2, which is lesser than 2^((K/2)+1), and hence f(1/2) is lesser than 2^(K/2+1)/2^K=1/2^(K/2-1)=1/2^((N-3)/2). Obviously, exponential in N decreases to 0 much faster than 1/N, and so for large enough N we indeed have f(1)&gt;1/N&gt;f(1/2), as required.</p>
<p>#3:<br />
This solution is somewhat long and messy, so I will leave some parts as exercise.</p>
<p>Denote by p the probability of heads, q the probability of tails (p+q=1), and choose them such that p*q=1/N (possible iff N is at least 4). Flip the coin a large number K of times. We will assign the results of the raffle to the results of the coin flips in such a way that if all coin flips were changed, we will choose the same person, with the exception of results with equal numbers of heads and tails (if K is even). We will then have basic &#8220;building blocks&#8221; with sizes of the form p^l*q^m+p^m*q^l for m+l=K, l&gt;m non-negative integers, or p^l*q^m when l=m=K/2. Using the basic relations p+q=1, pq=1/N, it is possible to partially compute the above expressions and see that they can all be represented as rational numbers with denominator N^[K/2] (where [x]=floor(x)). Furthermore we have all the following properties:</p>
<p>1) The integers (N^[K/2])*(p^l*q^m+p^m*q^l), or half of that for m=l, decrease as m increases, for m up to [K/2];<br />
2) For all integers r from 0 to [K/2]-1, the integer corresponding to m=r is less than N times greater than the integer corresponding to m=r+1;<br />
3) For all r from 0 to [K/2], there are (K choose r) appearances of the integer corresponding to m=r, and hence at least K appearances for all r from 1 to [K/2];<br />
4) The sum of all these integers, counting multiple appearances, is of course N^[K/2] by the binomial theorem;<br />
5) The smallest of these integers (corresponding to m=[K/2]) is exactly 1;</p>
<p>These properties guarantee that as long as K is at least N^2, it is possible to divide the integers above into N sets, such that each set will have sum exactly N^[K/2]-1, which once we return to the original probabilities by dividing by N^[K/2], yields exactly the wanted results.<br />
The properties above imply this by implying something somewhat stronger: They imply that if we try dividing these integers into sets by taking at each step the largest integer not yet used, and trying to place it into a set such that it will not make its sum exceed N^[K/2]-1, we will succeed: Properties 2 and 3 and 4, together with K &gt; N^2, imply that this process will not halt before we reach the smallest integers, and properties 4 and 5 imply that the smallest integers will always fit into the sets, because they are of size 1. This concludes this long proof.</p>
<p>Some analysis and comparison: Solutions #1 and #2 are quite similar, and in fact are completely the same in the case that N-1 is prime. The extension to other cases is quite different though: Solution #2 is efficient in coin tossing, always requiring only N-1 tosses, but the calculation of the polynomial f(P), and thus of P, might be long and annoying. On the other hand, solution #1 always uses a simple polynomial that needs to be solved to find P, but also depends on finding a prime in the arithmetic sequence, which might be difficult and gives no simple estimation of the number of coin tosses as a function of N. Solution 3 only requires solving a quadratic in order to obtain the probability p, and only O(N^2) tosses (possibly significantly less), but actually assigning the results seems more complicated than in #1 and #2.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yair</title>
		<link>http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/comment-page-1/#comment-11685</link>
		<dc:creator>Yair</dc:creator>
		<pubDate>Sun, 19 Oct 2008 17:57:54 +0000</pubDate>
		<guid isPermaLink="false">http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/#comment-11685</guid>
		<description>hey, I think I have some partial solution.
if I had more free time or if I was as smart as I used to be I&#039;d try to finalize it :) maybe you can :)

it goes like this:

we toss the coin K times.
the coin&#039;s odds, P, are such that P^K+(1-P)^K=1/N.
I think we can find such P for every K&gt;1, N&gt;1. but I leave proving that as an exercise :)

if all tosses are the same, then we choose the number N.

if they&#039;re not, then let&#039;s look at the number of possible combinations that have the same heads/tails count, C.
there are K!/C!/(K-C)! such combinations.
if we chose K right, that divides by N-1 for every C except for 0 and K.
so we can group all of the tosses of same heads/tails count to N-1 equal groups. and each group will give a different number from 1 to N-1.
what K can do the job? I think maybe (N-1)^2 can. but I&#039;ll leave that as an exercise too :)

maybe my blanks/exercises here can be filled and maybe not :)</description>
		<content:encoded><![CDATA[<p>hey, I think I have some partial solution.<br />
if I had more free time or if I was as smart as I used to be I&#8217;d try to finalize it <img src='http://leviathanonline.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  maybe you can <img src='http://leviathanonline.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>it goes like this:</p>
<p>we toss the coin K times.<br />
the coin&#8217;s odds, P, are such that P^K+(1-P)^K=1/N.<br />
I think we can find such P for every K&gt;1, N&gt;1. but I leave proving that as an exercise <img src='http://leviathanonline.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>if all tosses are the same, then we choose the number N.</p>
<p>if they&#8217;re not, then let&#8217;s look at the number of possible combinations that have the same heads/tails count, C.<br />
there are K!/C!/(K-C)! such combinations.<br />
if we chose K right, that divides by N-1 for every C except for 0 and K.<br />
so we can group all of the tosses of same heads/tails count to N-1 equal groups. and each group will give a different number from 1 to N-1.<br />
what K can do the job? I think maybe (N-1)^2 can. but I&#8217;ll leave that as an exercise too <img src='http://leviathanonline.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>maybe my blanks/exercises here can be filled and maybe not <img src='http://leviathanonline.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yaniv</title>
		<link>http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/comment-page-1/#comment-11683</link>
		<dc:creator>yaniv</dc:creator>
		<pubDate>Sun, 19 Oct 2008 15:29:59 +0000</pubDate>
		<guid isPermaLink="false">http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/#comment-11683</guid>
		<description>I must say that I second m0she&#039;s request, although I still haven&#039;t thought about the single coin form of the riddle enough.

Dan - you are welcome to post your solutions.</description>
		<content:encoded><![CDATA[<p>I must say that I second m0she&#8217;s request, although I still haven&#8217;t thought about the single coin form of the riddle enough.</p>
<p>Dan &#8211; you are welcome to post your solutions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: m0she</title>
		<link>http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/comment-page-1/#comment-11682</link>
		<dc:creator>m0she</dc:creator>
		<pubDate>Sun, 19 Oct 2008 15:08:08 +0000</pubDate>
		<guid isPermaLink="false">http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/#comment-11682</guid>
		<description>Dan,
It&#039;s been a year - Please post your solutions.

Thanks!</description>
		<content:encoded><![CDATA[<p>Dan,<br />
It&#8217;s been a year &#8211; Please post your solutions.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/comment-page-1/#comment-97</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Fri, 31 Aug 2007 01:48:24 +0000</pubDate>
		<guid isPermaLink="false">http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/#comment-97</guid>
		<description>It is indeed completely solvable. In fact, I know of two very different solutions to the problem, both quite provable.</description>
		<content:encoded><![CDATA[<p>It is indeed completely solvable. In fact, I know of two very different solutions to the problem, both quite provable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yaniv</title>
		<link>http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/comment-page-1/#comment-96</link>
		<dc:creator>yaniv</dc:creator>
		<pubDate>Thu, 30 Aug 2007 21:35:15 +0000</pubDate>
		<guid isPermaLink="false">http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/#comment-96</guid>
		<description>Dan,

Until now I only heard rumors about a solution using only a single coin.

I have not given it any thought yet, as these rumors said that the result bases itself on some unproven hypothesis.

I understand from your comment that the riddle with a single coin has a valid solution (please confirm this).

If so I will sure think about it! (as I am sure will do many other readers of this blog).

Anyway, thanks a lot for not revealing the solution yet!</description>
		<content:encoded><![CDATA[<p>Dan,</p>
<p>Until now I only heard rumors about a solution using only a single coin.</p>
<p>I have not given it any thought yet, as these rumors said that the result bases itself on some unproven hypothesis.</p>
<p>I understand from your comment that the riddle with a single coin has a valid solution (please confirm this).</p>
<p>If so I will sure think about it! (as I am sure will do many other readers of this blog).</p>
<p>Anyway, thanks a lot for not revealing the solution yet!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/comment-page-1/#comment-94</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Thu, 30 Aug 2007 21:18:18 +0000</pubDate>
		<guid isPermaLink="false">http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/#comment-94</guid>
		<description>This question originates (as far as I know) in the Gillis-Turan binational mathematical olympiad.

Nadav&#039;s solution was the one I originally had, and I like it a lot. You can save a few coin tosses by taking lcm(2,3,...,N), but that&#039;s not very important. There are several more solutions based on the tactic of splitting into two sets, each with members of equal probabilities , then using the second coin to correct them. I know of another solution which is quite different, but I won&#039;t detail it right now as it helps to solve the (much harder, but not impossible) question: Do the same, but with one coin only!</description>
		<content:encoded><![CDATA[<p>This question originates (as far as I know) in the Gillis-Turan binational mathematical olympiad.</p>
<p>Nadav&#8217;s solution was the one I originally had, and I like it a lot. You can save a few coin tosses by taking lcm(2,3,&#8230;,N), but that&#8217;s not very important. There are several more solutions based on the tactic of splitting into two sets, each with members of equal probabilities , then using the second coin to correct them. I know of another solution which is quite different, but I won&#8217;t detail it right now as it helps to solve the (much harder, but not impossible) question: Do the same, but with one coin only!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yaniv</title>
		<link>http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/comment-page-1/#comment-86</link>
		<dc:creator>yaniv</dc:creator>
		<pubDate>Sat, 25 Aug 2007 23:10:03 +0000</pubDate>
		<guid isPermaLink="false">http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/#comment-86</guid>
		<description>Nadav,

Extremely cool solution!

In my opinion it is the easiest solution proposed thus far (although it is not very economic - it &quot;wastes&quot; a lot of coin tosses).

Actually an interesting sequel would be to calculate the bounds on the number of tosses required by the different solutions.</description>
		<content:encoded><![CDATA[<p>Nadav,</p>
<p>Extremely cool solution!</p>
<p>In my opinion it is the easiest solution proposed thus far (although it is not very economic &#8211; it &#8220;wastes&#8221; a lot of coin tosses).</p>
<p>Actually an interesting sequel would be to calculate the bounds on the number of tosses required by the different solutions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yair</title>
		<link>http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/comment-page-1/#comment-85</link>
		<dc:creator>yair</dc:creator>
		<pubDate>Sat, 25 Aug 2007 22:20:37 +0000</pubDate>
		<guid isPermaLink="false">http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/#comment-85</guid>
		<description>Cool solution Nadav!
You even solve a broader problem - you can choose a random number in any smaller range too.</description>
		<content:encoded><![CDATA[<p>Cool solution Nadav!<br />
You even solve a broader problem &#8211; you can choose a random number in any smaller range too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nadav</title>
		<link>http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/comment-page-1/#comment-81</link>
		<dc:creator>Nadav</dc:creator>
		<pubDate>Sat, 25 Aug 2007 13:18:41 +0000</pubDate>
		<guid isPermaLink="false">http://yaniv.leviathanonline.com/blog/riddles/what-are-the-odds/#comment-81</guid>
		<description>So I have a different solution than the previous 2.
Let the first coin have the probability of 1/2.
Let K be the largest number, that implies 2^K &lt; N!.
Let the second coin have the probability of Q=2^K/N!
Given a number x in [1..N], I&#039;ll demonstrate a method of creating a probability of 1/x
1. Select M=N!/x
2. Flip the even coin K times.
3. If the binary coded number is smaller than M, Flip the non-even coin.
4. If it fell on &#039;Heads&#039; (the Q probability), return &quot;True&quot;
5. If the binary coded number is M or larger, or the non-even coin fell on &#039;Tails&#039;, return &quot;False&quot;

The probability of &quot;True&quot;, is therefore M/(2^K)*Q=M/2^K*2^K/N=M/N=N!/x/N!=1/x
Therefore, we have a virtual coin, with a probability of 1/x for every x in [1..N]

No, the algorithm will be:
1. Select 1 in a probability of 1/N. if failed continue.
2. Select 2 in a probability of 1/(N-1). if failed continue.
and so on...</description>
		<content:encoded><![CDATA[<p>So I have a different solution than the previous 2.<br />
Let the first coin have the probability of 1/2.<br />
Let K be the largest number, that implies 2^K &lt; N!.<br />
Let the second coin have the probability of Q=2^K/N!<br />
Given a number x in [1..N], I&#8217;ll demonstrate a method of creating a probability of 1/x<br />
1. Select M=N!/x<br />
2. Flip the even coin K times.<br />
3. If the binary coded number is smaller than M, Flip the non-even coin.<br />
4. If it fell on &#8216;Heads&#8217; (the Q probability), return &#8220;True&#8221;<br />
5. If the binary coded number is M or larger, or the non-even coin fell on &#8216;Tails&#8217;, return &#8220;False&#8221;</p>
<p>The probability of &#8220;True&#8221;, is therefore M/(2^K)*Q=M/2^K*2^K/N=M/N=N!/x/N!=1/x<br />
Therefore, we have a virtual coin, with a probability of 1/x for every x in [1..N]</p>
<p>No, the algorithm will be:<br />
1. Select 1 in a probability of 1/N. if failed continue.<br />
2. Select 2 in a probability of 1/(N-1). if failed continue.<br />
and so on&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
