Improved Combinations with the BigInteger Data Type

I wrote an article titled “Improved Combinations with the BigInteger Data Type” which has been published in the August 2012 issue of Visual Studio Magazine. See http://visualstudiomagazine.com/articles/2012/08/01/biginteger-data-type.aspx.

A mathematical combination is a subset of a group of items, where order doesn’t matter. For example if the group size is n = 5 and the subset size is k = 3, then there are Choose(5,3) = 10 possible combination elements:

0 1 2
0 1 3
0 1 4
0 2 3
0 2 4
0 3 4
1 2 3
1 2 4
1 3 4
2 3 4

Mathematical combinations often involve huge numbers (far larger than int.MaxValue which is about 2 billion) and here’s where the .NET BigInteger data type, which can store arbitrarily large values, is tremendously useful. The screenshot below gives you a good idea of what the Visual Studio Magazine article explains.

This entry was posted in Software Test Automation. Bookmark the permalink.