We can use simple programs in JavaScript to calculate any probability. See JavaScript. Some example. (Copy and paste the lines at the top of this page) 1) In a dice game players throw three dice; who first gets at least 2 equal numbers wins. What is the probability of getting this in a throw? <pre><script> with(Math) { n=1e4; x=0; for(i=0; i<n; i=i+1) { U1=floor(random()*6+1); U2=floor(random()*6+1); U3=floor(random()*6+1); s=0 if(U1==U2) s=1; if(U1==U3) s=1; if(U2==U3) s=1; x=x+s} document.writeln("n=",n," P = ",x/n*100,"% +/- ",sqrt(x/n*(1-x/n)/sqrt(n-1)*300),"%" ) n=n*10; x=0; for(i=0; i<n; i=i+1) { U1=floor(random()*6+1); U2=floor(random()*6+1); U3=floor(random()*6+1); s=0 if(U1==U2) s=1; if(U1==U3) s=1; if(U2==U3) s=1; x=x+s} document.writeln("n=",n," P = ",x/n*100,"% +/- ",sqrt(x/n*(1-x/n)/sqrt(n-1)*300),"%" ) n=n*10; x=0; for(i=0; i<n; i=i+1) { U1=floor(random()*6+1); U2=floor(random()*6+1); U3=floor(random()*6+1); s=0 if(U1==U2) s=1; if(U1==U3) s=1; if(U2==U3) s=1; x=x+s} document.writeln("n=",n," P = ",x/n*100,"% +/- ",sqrt(x/n*(1-x/n)/sqrt(n-1)*300),"%" ) } </script></pre> n=10000 P = 44.76% +/- 0.861278010237021% n=100000 P = 44.536% +/- 0.4840864325165218% n=1000000 P = 44.4183% +/- 0.2721495467311992% The precision calculated by sqrt(x/n*(1-x/n)/sqrt(n-1)*3 (put after "+/-") is not "certain": there is a small probability (0.03%) that the deviation of the value found from the true value is greater than it. 2) In a certain population of adults in a given region, a particular childhood disease is known to affect 1 in 8 people. If you consider 100 adult people from that region, calculate the probability that no more than 10 have been affected by it. <pre><script> with(Math) { P = 1/8 n=1e4; x=0; for(i=0; i<n; i=i+1) { k=0; for(j=0; j<100; j=j+1) if(random() < P) k=k+1; if(k<11) x=x+1 } document.writeln (x/n*100,"% +/- ",sqrt(x/n*(1-x/n)/sqrt(n-1)*300),"%" ) n=n*2; x=0; for(i=0; i<n; i=i+1) { k=0; for(j=0; j<100; j=j+1) if(random() < P) k=k+1; if(k<11) x=x+1 } document.writeln (x/n*100,"% +/- ",sqrt(x/n*(1-x/n)/sqrt(n-1)*300),"%" ) n=n*2; x=0; for(i=0; i<n; i=i+1) { k=0; for(j=0; j<100; j=j+1) if(random() < P) k=k+1; if(k<11) x=x+1 } document.writeln (x/n*100,"% +/- ",sqrt(x/n*(1-x/n)/sqrt(n-1)*300),"%" ) n=n*2; x=0; for(i=0; i<n; i=i+1) { k=0; for(j=0; j<100; j=j+1) if(random() < P) k=k+1; if(k<11) x=x+1 } document.writeln (x/n*100,"% +/- ",sqrt(x/n*(1-x/n)/sqrt(n-1)*300),"%" ) n=n*2; x=0; for(i=0; i<n; i=i+1) { k=0; for(j=0; j<100; j=j+1) if(random() < P) k=k+1; if(k<11) x=x+1 } document.writeln (x/n*100,"% +/- ",sqrt(x/n*(1-x/n)/sqrt(n-1)*300),"%" ) } </script></pre> 28.36% +/- 0.780732731440065% 28.095% +/- 0.6546401245339797% 28.0925% +/- 0.5504661699402846% 28.19% +/- 0.4633716818209928% 27.975% +/- 0.38873889099144% 3) I throw a balanced coin 200 times. What is the probability of 100 heads? <pre><script> with(Math) { n=1e4; x=0; for(i=0; i<n; i=i+1) { Head=0; for(j=0; j<200; j=j+1) if(random() > 0.5) Head=Head+1; if(Head==100) x=x+1 } document.writeln (x/n*100,"% +/- ",sqrt(x/n*(1-x/n)/sqrt(n-1)*300),"%" ) n=n*2; x=0; for(i=0; i<n; i=i+1) { Head=0; for(j=0; j<200; j=j+1) if(random() > 0.5) Head=Head+1; if(Head==100) x=x+1 } document.writeln (x/n*100,"% +/- ",sqrt(x/n*(1-x/n)/sqrt(n-1)*300),"%" ) n=n*2; x=0; for(i=0; i<n; i=i+1) { Head=0; for(j=0; j<200; j=j+1) if(random() > 0.5) Head=Head+1; if(Head==100) x=x+1 } document.writeln (x/n*100,"% +/- ",sqrt(x/n*(1-x/n)/sqrt(n-1)*300),"%" ) n=n*2; x=0; for(i=0; i<n; i=i+1) { Head=0; for(j=0; j<200; j=j+1) if(random() > 0.5) Head=Head+1; if(Head==100) x=x+1 } document.writeln (x/n*100,"% +/- ",sqrt(x/n*(1-x/n)/sqrt(n-1)*300),"%" ) n=n*2; x=0; for(i=0; i<n; i=i+1) { Head=0; for(j=0; j<200; j=j+1) if(random() > 0.5) Head=Head+1; if(Head==100) x=x+1 } document.writeln (x/n*100,"% +/- ",sqrt(x/n*(1-x/n)/sqrt(n-1)*300),"%" ) n=n*2; x=0; for(i=0; i<n; i=i+1) { Head=0; for(j=0; j<200; j=j+1) if(random() > 0.5) Head=Head+1; if(Head==100) x=x+1 } document.writeln (x/n*100,"% +/- ",sqrt(x/n*(1-x/n)/sqrt(n-1)*300),"%" ) } </script></pre> 5.54% +/- 0.3962327222918004% 5.84% +/- 0.34154521533431015% 5.525% +/- 0.2798162521554175% 5.6775% +/- 0.2383283524799421% 5.61625% +/- 0.19938989300873827% 5.639375% +/- 0.16799036117620117%