Suppose you and a bunch of friends are sitting around a table.
There are N of you.
You have a jug of beer in front of you, which no one has yet tasted.
So you take a swig of it, and then pass it to your left or right with probability 1/2.
Now suppose your neighbor does the samehe/she takes a swig of it and passes it to his/her left or right with probablity 1/2.
Each player continues in this fashion.
Because the beer is moving back and forth randomly around the table, it may be a while before some people get to taste the beer for the first time.
Which person around the table is most likely to be the last one to try the beer?
Is it a person near you or far from you?
(Assume that the jug is bottomless, and never runs out.)
Source: Math fun facts
RANDOMIZE TIMER
defdbl az
CLS
DIM lastPosCt(12)
FOR tr = 1 TO 100000000
REDIM had(12)
had(6) = 1: hadCt = 1
location = 6
DO
delta = SGN(2 * RND(1)  1)
location = location + delta
IF location > 12 THEN location = location  12
IF location < 1 THEN location = location + 12
IF had(location) = 0 THEN had(location) = 1: hadCt = hadCt + 1
LOOP UNTIL hadCt = 12
lastPosCt(location) = lastPosCt(location) + 1
IF tr MOD 1000000 = 0 THEN
FOR i = 1 TO 12
PRINT lastPosCt(i);
NEXT
PRINT
IF INKEY$ > "" THEN PRINT: RANDOMIZE TIMER: PRINT
END IF
NEXT tr
PRINT: PRINT
PRINT lastPosCt(12);
FOR i = 1 TO 5
PRINT (lastPosCt(i) + lastPosCt(12  i)) / 2;
NEXT
PRINT
The program simulates starting at position 6, as in 6 o'clock; the opposite side is 12, as in a clock face.
After 100 million trials, where at humanrandomly chosen points the pseudorandom number generator was rerandomized, the following set of statistics appeared.
The statistics for the final resting place, from 1 to 12 respectively are:
9102018 9009604 9081630 9053443 9144911 0 9145662 9052964 9081760 9009555 9102281 9216172
Due to symmetry we can average opposite sides:
12 1 and 11 2 and 10 3 and 9 4 and 8 5 and 7
9216172 9102149.5 9009579.5 9081695 9053203.5 9145286.5
The last person to get the beer is at 12, directly opposite the start.
The second most frequent are the two immediately adjacent to the start.
Then comes immediately adjacent to the opposite point, part of the same buildup to the opposite.
Then there seems to be a minor bump halfway around at 3 o'clock and 9 o'clock.
Edited on April 9, 2013, 7:38 pm

Posted by Charlie
on 20130409 18:34:01 