# Sum of Uniformly Distributed Random Numbers

Think of this as a mathematical intuition puzzle. You could work it out analytically, or you might write a computer program and beat it to death numerically (don't bother, since such a program written in JavaScript is embedded in this page), but the point is to first see if you can intuit the correct answer from the mathematical properties of the components of the problem. It's well worth a little head scratching, as the result is quite beautiful and shows how seemingly unrelated things in mathematics show a deeper unity when you look more closely at them.

## Random Number Blackjack

The problem involves a game something like blackjack, but played with random numbers between zero and one instead of a deck of cards. To be precise, the random numbers are uniformly distributed, which means that all numbers in the range are equally probable, and greater than or equal to zero and less than one. It doesn't matter whether the numbers are true hardware-generated random values or a pseudorandom sequence generated by a computer.

To play the game, start with a sum of zero. “Draw” a random number from the generator, and add it to the sum. Since the generator always returns numbers less than one (although they can be arbitrarily close to one), the sum after one draw will always be less than one. Tally one number drawn. Now draw another random number from the generator, add one to the tally of numbers drawn, and add it to the sum. If the sum is now greater than one, you've “gone bust”—record the tally of numbers drawn, reset the sum to zero, and continue with another “hand”. While the sum remains less than one, continue to draw numbers, increment the tally, and add them to the sum until it exceeds one, then record the tally at which you went bust.

Here's an example of several “hands” of the game.

Hand 1
Tally Draw Sum
0 0.0000
10.47700.4770
20.05160.5286
30.17930.7079
40.22500.9329
50.04380.9767
60.30061.2774Bust!

In this first hand, it took six “draws” from the random number generator before the sum exceeded one. We record the final tally of 6 as the result of the hand and try another.

Hand 2
Tally Draw Sum
0 0.0000
10.84740.8474
20.30051.1479Bust!

This time we went bust on only the second draw. Again, recording the tally of 2, we try again.

Hand 3
Tally Draw Sum
0 0.0000
10.55350.5535
20.27210.8257
30.53901.3646Bust!

This time we bust out on the third draw, so we note the final tally of 3. At this point the list of tallies from the three hands so far reads:

Hand Tally
1 6
2 2
3 3

Now let us compute the average (to be precise, the arithmetic mean) of the number of draws it took to go bust. This is just the sum of the tallies for all the hands played so far divided by the number of hands. After three hands, we compute this average (rounded to four decimal places) as:

(6 + 2 + 3) / 3 = 3.6667

Now we can pose the puzzle question:

As the number of hands increases, does the average number of draws per hand converge to a specific value, and if so, what?

### References

Derbyshire, John. Prime Obsession. New York: Plume,  2004. ISBN 0-452-28525-9. Pages 366–367.
Weisstein, Eric W. “Uniform Sum Distribution.” From MathWorld—A Wolfram Web Resource.

by John Walker
January, 2006

This document is in the public domain.