http://zak.s206.xrea.com/bitratetest/abxtable.htm

This is probably the simplest way.

/////////////////////////////////////////////////////

// Probability formula without factorial, power, approximation

// Written in JavaScript.

// FIRST, make pascal triangle.

// SECOND, accumulate from right to left, adding itself to left cell,

// 10/13 is more like the 10+/13, sum of 13/13, 12/13, 11/13, 10/13.

// FINALLY, you get the binomial probability table.

/////////////////////////////////////////////////////

var i = 0;

var j = 0;

/////////////////////////////////////////////////////

// YOU can change the size of the table by just rewriting below.

var max_trials = 30;

var max_correct_responses = 18;

/////////////////////////////////////////////////////

pascal_triangle = new Array(max_trials);

probability_table = new Array(max_trials);

/////////////////////////////////////////////////////

// Initialize tables. Fill all zero.

/////////////////////////////////////////////////////

for(i=0;max_trials>=i;i++){

pascal_triangle[i] = new Array(max_trials+1);

probability_table[i] = new Array(max_trials+1);

for(j=0;max_trials>=j;j++){

pascal_triangle[i][j] = 0.0;

probability_table[i][j] = 0.0;

}

}

pascal_triangle[0][0] = 1.0;// SEED

/////////////////////////////////////////////////////

// Propagate pascal triangle directly below

// Distribute evenly (half to down-left, half to down-right.)

/////////////////////////////////////////////////////

for(i=0;max_trials>i;i++){

for(j=0;i>=j;j++){

pascal_triangle[i+1][j] += pascal_triangle[i][j]*0.5;

pascal_triangle[i+1][j+1] += pascal_triangle[i][j]*0.5;

}

}

/////////////////////////////////////////////////////

// IT'S SHOWTIME!!!!!!

// ACCUMULATE!!!!!!!!!

/////////////////////////////////////////////////////

for(i=0;max_trials>=i;i++){

var acum = 0.0;

for(j=i;j>=0;j--){

acum += pascal_triangle[i][j];

probability_table[i][j] = acum;

}

}

/////////////////////////////////////////////////////

// Output the result as HTML.

/////////////////////////////////////////////////////

var str = "<table border>";

str += "<tr>";

str += "<th> </th>";

str += '<th colspan="'+(max_correct_responses+1)+'">NUMBER OF TRIALS WITH CORRECT RESPONSES </th>'

str += "</tr>";

str += "<tr>";

str += "<th>TRIALS</th>";

for(i=0;max_correct_responses>=i;i++){

str += "<th rowspan="+(i+1)+">"+i+"</th>";

}

str += "</tr>";

for(i=0;max_trials>=i;i++){

str += "<tr><th>";

str += i;

str += "</th>";

for(j=0;Math.min(i,max_correct_responses)>=j;j++){

var num = probability_table[i][j];

var num_str = num.toFixed(5);

var popup_str = j+"+ of "+i+", p="+num;

var significance_level = 'style="background-color:#fdd;"'; //red

if(0.05>num)significance_level = 'style="background-color:#ffc;"';//yellow

if(0.01>num)significance_level = 'style="background-color:#dfe;"';//green

//must be blueish green for colorblind to recognize difference between red.

str += '<td title="'+popup_str+'" '+significance_level+'>'+num_str+'</td>';

}

str += "</tr>";

}

str += "<tr>";

str += "<th> </th>";

for(i=0;max_correct_responses>=i;i++){

str += "<th>"+i+"</th>";

}

str += "</tr>";

str += "</table>";

document.write(str);