Hacker News new | ask | show | jobs
by randomswede 1584 days ago
Off the top of my head, I don't know. It MAY be related to the fact that 6*3 is 216, but I don't have deep enough statistics knowledge to say for sure. You coudl try it again with 3 8-sided dice and rolling 24, that should give you ~50% at 344 iterations, and ~90% at 1177 iterations. If my supposition that the mean is related to the possible rolls, then the mean should end up being 512.

Iteration counts gathered with Python and a (manual) binary search (actually faster than writing code).

1 comments

    runs <- 100000
    x <- vector(mode = "numeric", length = runs)
    for (i in 1:runs){
      while (sum(sample(1:8, size = 3, replace = TRUE)) != 24){
        x[i] <- x[i] + 1
      }
    }

    summary(x)
     Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
      0.0   146.0   353.0   511.8   708.0  5112.0 

    quantile(x, c(0.5, 0.8, 0.9))
     50%  80%  90% 
     353  824 1187
Strangely enough the mean agrees. The other ntiles are off a bit, but that's randomness for you.