(In reply to
solution by Charlie)
The following program simulates a million trials for each of n = 1 through 20, and the results compare well with the calculated values:
CLS
FOR n = 1 TO 20
tot = 0: tr = 0
FOR trial = 1 TO 1000000
vMax = 0
FOR i = 1 TO n
v = INT(6 * RND(1) + 1)
IF v > vMax THEN vMax = v
IF v = 6 THEN EXIT FOR
NEXT i
tot = tot + vMax
tr = tr + 1
NEXT trial
PRINT n, tot / tr
NEXT n
1 3.500303
2 4.473519
3 4.957712
4 5.245496
5 5.431711
6 5.558989
7 5.65431
8 5.724804
9 5.778415
10 5.819911
11 5.853186
12 5.880825
13 5.900625
14 5.918705
15 5.933204
16 5.944188
17 5.95386
18 5.962127
19 5.968116
20 5.97373
|
Posted by Charlie
on 2004-12-08 19:00:05 |