What's the probability that
n random numbers from [0,1] will sum less than 1?
(For purists: "uniformly distributed, independent" random numbers are assumed.)
Simulation seems to indicate the answer is 1/n!. I don't have a proof of why this is the case. Here are the results:
n sum<1 # trials fraction reciprocal
3 99943 600000 0.16657166 6.003422
4 24846 600000 0.04141000 24.14876
5 4969 600000 0.00828167 120.7486
6 858 600000 0.00143000 699.3007
7 121 600000 0.00020167 4958.678
8 18 600000 0.00003000 33333.33
9 0 600000 0.00000000 inf
10 2 600000 0.00000333 300000
11 0 600000 0.00000000 inf
12 0 600000 0.00000000 inf
With the exception of the larger values of n where the scarcity of successes results in erratic results, the reciprocal of the fraction of trials that are successes is close to the factorial of n.
RANDOMIZE TIMER
CLS
FOR n = 3 TO 12
ctr = 0
FOR tr = 1 TO 600000
t = 0
FOR i = 1 TO n
t = t + RND(1)
NEXT i
IF t < 1 THEN ctr = ctr + 1
NEXT tr
PRINT USING "## ###### ###### ##.######## "; n; ctr; tr - 1; ctr / (tr - 1); ' as loop leaves tr advanced by 1
IF ctr > 0 THEN
PRINT (tr - 1) / ctr
ELSE
PRINT "inf"
END IF
NEXT n
|
Posted by Charlie
on 2004-07-29 08:52:40 |