You are viewing a single comment's thread. Return to all comments →
Hints: Get the 6x6 transfer probability matrix
P[i,j] := Pr(d[n+1]=i | d[n]=j).
Calculate and store P^n and S[n]=I+P+P^2+...+P^n for all n=1..N in O(N) time.
When calculating the variance, beware that the formula
var(X) = <X^2> - <X>^2
has loss-of-significance issues due to cancelation of large quantities.
Seems like cookies are disabled on this browser, please enable them to open this website
Dice Stats
You are viewing a single comment's thread. Return to all comments →
Hints: Get the 6x6 transfer probability matrix
Calculate and store P^n and S[n]=I+P+P^2+...+P^n for all n=1..N in O(N) time.
When calculating the variance, beware that the formula
has loss-of-significance issues due to cancelation of large quantities.