2

Suppose you have a fair n-sided die $D_n$ - or rather suppose you don't have a $D_n$ but want to simulate one by repeatedly (but finitely many times) throwing a single (possibly biased) coin $C_p$ that has a probability of $p\in (0,1)$ of landing on heads.

Two questions arise:

  1. Is it always possible to find a $p$ such that a $C_p$ can simulate a $D_n$?
  2. What is the minimum number of throws needed to simulate a $D_n$ with a suitable $C_p$?

For $n=2^k$ a power of $2$, this is easy: Just select $p=1/2$ and throw the (fair) coin $k$ times. All $n$ outcomes have equal probability $1/n$, so by labeling them $1, \ldots, n$, a $D_n$ can be simulated. Also, obviously, a $D_{2^k}$ cannot be simulated with less than $k$ throws, so the above way is in fact minimal.

For $n$ not a power of $2$, the first question is dealt with (and solved) in the November 2014 riddle of Michael Brand's site Using Your Head is Permitted. The second question, however, is far more tricky. The solution to the riddle shows that the minimum number of throws is bounded by the smallest number $k$ such that $$n \cdot \sum_{i=0}^k \left({k\choose i} \text{ mod }(n-1)\right)< 2^n.$$ (The sequence of these values of $k$ is in the OEIS as A251738.)

E.g., for $n=3$, the value for $k$ is $4$ since $$\begin{align} 3\cdot\sum_{i=0}^4 \left({4\choose i} \text{ mod }2\right)&=3\cdot\left((1\text{ mod }2)+(4\text{ mod }2)+(6\text{ mod }2)+(4\text{ mod }2)+(1\text{ mod }2)\right)\\ &=3\cdot(1+0+0+0+1)\\ &=6\\ &<8=2^3\text{, but }\\ 3\cdot\sum_{i=0}^3 \left({3\choose i} \text{ mod }2\right)&=3\cdot\left((1\text{ mod }2)+(3\text{ mod }2)+(3\text{ mod }2)+(1\text{ mod }2)\right)\\ &=3\cdot(1+1+1+1+1)\\ &=12\\ &>8=2^3\text{.}\\ \end{align}$$ The value $k=4$ is in fact also the minimum number of throws needed to simulate a $D_3$ by a $C_p$ (with a suitable $p$), but the proof is quite ugly since it involves several case distinctions. For larger values of $n$ that aren't powers of $2$, I have no clue whether the OEIS sequence A251738 is in fact the answer to question (2), even though I strongly suspect it is.

Does anyone know of a result that may help in proving or disproving my hypothesis?

jpvee
  • 3,563
  • Suggest you look at http://math.stackexchange.com/questions/812091/what-is-the-most-efficient-way-to-simulate-a-biased-coin-by-tossing-another-bias and http://math.stackexchange.com/questions/309003/can-you-simulate-any-probability-with-biased-coin-throws and http://math.stackexchange.com/questions/667198/how-to-choose-between-an-odd-number-of-options-with-a-fair-coin and http://math.stackexchange.com/questions/971918/biased-coin-flip-from-an-unbiased-coin-flip and http://math.stackexchange.com/questions/146605/improving-von-neumanns-unfair-coin-solution and so on. – Gerry Myerson Jan 02 '15 at 01:05
  • Have you had a chance to look at any of these links? – Gerry Myerson Jan 03 '15 at 19:44
  • @GerryMyerson: Thanks for the many links. I did look at them, but they all seem to deal with scenarios in which the number of allowed coin tosses is unbounded, whereas I am interested in algorithms involving a simulation of a fair die by a fixed number $k$ of coin tosses. – jpvee Jan 05 '15 at 11:45
  • Maybe the problem is that you can't simulate a fair die exactly by any fixed number of tosses of a fair coin. – Gerry Myerson Jan 05 '15 at 23:40
  • Right; that's why all of my question is dealing with biased coins. – jpvee Jan 06 '15 at 11:29
  • OK, I'll try to read more carefully. Have you seen Toshiya Itoh, Simulating Fair Dice with Biased Coins, Information and Computation, Volume 126, Issue 1, 10 April 1996, Pages 78–82? It might be available from http://www.sciencedirect.com/science/article/pii/S089054019690036X Also, http://www.kurims.kyoto-u.ac.jp/~kyodo/kokyuroku/contents/pdf/0871-21.pdf isn't exactly your question, but might have some useful ideas. – Gerry Myerson Jan 06 '15 at 14:43
  • Are you still there? – Gerry Myerson Jan 07 '15 at 16:44
  • 1
    Yep, but unfortunately with limited time for the matter. I did look at Itoh's paper, and it touches my original questions by linking to Feldman's (et al.'s) paper "On Dice and Coins: Models of Computation for Random Generation" which goes exactly as far as I got initially and also leaves my original question unanswered. I have, however, made some progress in restating the problem in a way which makes it tackable by computer search - I hope to be able to code it out in the next days and will post results here. – jpvee Jan 08 '15 at 10:06

0 Answers0