In a previous question (Calculating the Probability that 3 Random Numbers Sum to a Certain Number), I learned about the total number of ways that 3 random numbers between 1-100 can sum to 50.
But now I am interested in knowing if there is a way to estimate the "average number of times three random numbers (between 1-100) need to be generated before they sum to 50".
Conceptually, I know that someone could write a WHILE LOOP that attempts to estimate this number - but this could take a very long time. For example, here is some R code that can do this:
list_results <- list()
for (i in 1:100){
num_1_i = num_2_i = num_3_i = 0
sub_index <- 1 ## count it
while(num_1_i + num_2_i + num_3_i != 50){
num_1_i = runif(1,0,100)
num_2_i = runif(1,0,100)
num_3_i = runif(1,0,100)
sub_index <- sub_index + 1
}
inter_results_i <- data.frame(i, num_1_i, num_2_i, num_3_i, sub_index)
list_results[[i]] <- inter_results_i
}
do.call(rbind, list_results)
I know that in Probability Theory, we can use Markov Chains to find out quantities such as the "Mean Hitting Time" which describe the number of transitions required on average before a certain sequence of state transitions is observed - but in this case, I have 100 states and it would take far too long to write out the transition matrix for this problem and then attempt to perform algebraic operations on this matrix.
Thus, in general (with Markov Chains or without Markov Chains) - how would one attempt to estimate the "average number of times three random numbers (between 1-100) need to be generated before they sum to 50"?
Thanks!