IBM Research | Ponder This | September 2011 solutions

# Ponder This

## September 2011

<<August September October>>

2to6 can be viewed as a process that receives an integer and generates several dice throws.

Since 227 is not divisible by 6, we cannot guarantee that 2to6 will generate even a single die toss.

Given a number n and an upper bound N on its value, the best we can do is the following:

1) If N is zero then exit.
2) Throw away e=N(mod 6) cases.
3) Generate a die from (n-e) (mod 6).
4) Set n = floor(n/6) and N=(N-e)/6 and return to step 1

From 27 bits (N=227), we get a distribution of zero to ten dice tosses.

Repeating a similar algorithm for the 6to2 case on the result produces between zero and 25 bits.

Computing the expected value of the combined process results in ~23.99978 bits.

Can you explain the extraordinary closeness of the above result to an integer?

If you have any problems you think we might enjoy, please send them in. All replies should be sent to: ponder@il.ibm.com