I have been looking for an online calculator that can do combinatoric math calculations, specifically those that can be used to calculate poker hand probabilities and odds. These calculations are largely based on the binomial coefficient C(n,k). Not satisfied with my findings, I set out to build one myself.

At first this seemed quite the trivial task, just some number crunching. However I soon realized that the numbers used in these calculations can get large. Very large. The first step was making the C(n,k) calculation as efficient as possible by factoring out repetitive n! calculations. Doing that, in combination with arbitrary precision math functions, I was able to come up with a working function. It seems to work well and can handle very large numbers. (I haven't tested any beyond 1000, but that is certainly more than enough for poker hands.)

After getting C(n,k) working, the rest falls into place. The poker calculator uses the four pieces of information (outs, required outs, drawn, total) to compute the equation C(outs,required)*C(total-outs,drawn-required)/C(total,drawn)