Image of Blaise Pascal

Finding myself often computing binomial coefficients and binomial probabilities, and being dissatisfied with calculators that do not display all results for k from zero to n, I put this together. You can either enter n and p below, or pass them as a querystring, for example,, the classic example of tossing a fair coin ten times.

Probability of success
per trial:
Number of
*****Results will be displayed here when you click the COMPUTE button*****

Example: At the Monte Carlo casino on August 18, 1913, the roulette wheel came up black 26 times in a row. It was a single zero wheel, so the probability of black on each spin was 18/37 = ~.486486486. What was the probability of 26 black in a row? Click here to find out. (This is actually a bad example since you could just compute (18/37)26 and get the answer, but what the heck.)

Example for my grandkids: Using this calculator to solve the old "birthday problem" -- given a group of n people, what are the chances that two or more people have the same birthday? -- requires a two-step approach. Say the group size is 23. First thing is to find how many distinct pairs of people you can make from a group of 23, that is, the binomial coefficient 23 choose two. So enter 23 in the n box and anything (say .5) in the p box. Click compute. The binomial coefficient shown for n=23 and k=2 is 253. So you have 253 possible pairs of people. Now, enter 253 as n, and 1/365 (0.00273973) as p (we're disregarding leap years). Click compute. You have a ~50% (p=0.4995223425) chance of no pairs with a shared birthday, and thus a ~50% chance of one or more pairs each with a shared birthday. If you take the group size to 70, 70 choose 2 is 2415, and the chance of no pair with a shared birthday falls to 0.13%. Of course, if you had a group of 366 people (disregarding leap years, or 367 if you include leap years), obviously the probability of no shared birthdays would be zero, not some very tiny positive but finite number, as the binomial distribution predicts. But since 366 choose 2 is 66795, if you try this as n and .00273973 as p, the probability of no shared birthdays is computed as 2.599704056 x 10-80, which is about equal to one, divided by the number of atoms in the observable universe, so it's close enough to zero not to worry about.

Caveat arithemeticus: Numbers displayed in the result table show 10 significant digits and scale from about 10-322 to 10322. Columns 3 and 4 (cumulative probabilities) approach 1; if the significand rounds to 1, they just show 1. Display ends when k=n, or when one or more factors go out of range. If a factor goes out of range, a message is displayed showing the factor and its JavaScript value. A JavaScript value of "infinity" does not really mean infinity, just a positive number beyond the range of JavaScript's floating point representation.