Skip to content

Instantly share code, notes, and snippets.

@weatherspud
Last active December 28, 2016 19:02
Show Gist options
  • Save weatherspud/2fc400b94b56a0d37c0f49208ccf018a to your computer and use it in GitHub Desktop.
Save weatherspud/2fc400b94b56a0d37c0f49208ccf018a to your computer and use it in GitHub Desktop.
fair_dice_test.pari
$ gp
? \\ 2 rolls: reject fair d6
? 1 / 6.0
%1 = 0.16666666666666666666666666666666666667
? \\ 2 rolls: accept unfair d6 (75% 6, others equal)
? 1 - (.75^2 + 5 * (.25 / 6)^2)
%2 = 0.42881944444444444444444444444444444445
? \\ 3 rolls, accept on 2: reject fair d6
? (1 / 6.0)^2
%3 = 0.027777777777777777777777777777777777778
? \\ 3 rolls, accept on 2: accept unfair d6 (75% 6, others equal prob)
? 1 - (.75^3 + 5 * (.25 / 6)^3)
%4 = 0.57776331018518518518518518518518518519
? \\ 3 rolls, reject on 2: reject fair d6
? (1 / 6.0)^2 + 6 * 5 * (1 / 6.0)^2 * (1 / 6.0)
%5 = 0.16666666666666666666666666666666666667
? \\ 3 rolls, reject on 2: reject fair d6
? 3 * .75 * binomial(5, 2) * (.25 / 6.0)^2 + binomial(5, 3) * (.25 / 6.0)^3
%6 = 0.039785879629629629629629629629629629630
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment