The Thue-Morse Sequence that shows over infinite tries the “fairest” way for two people to take turns when choosing things from a pool (i.e. drafting players for a kick-ball team). Matt Parker has a very entertaining YouTube video on the subject and John D. Cook has a clear example as well. Between two players the…

# C#

## Addition of Very Large Numbers

It’s not uncommon to get to a point in mathematics or programming that very large numbers must be dealt with. For the context of this post I will define a very large number (VLN) as any number that exceeds the maximum value of an unsigned 64-bit integer (aka ulong.MaxValue or 18,446,744,073,709,551,615). It’s surprisingly easy to…

## Investigating Basic Combinatorics

In programming and in math we are often interested in how many possible combinations of objects exist. For example: how many 5-hand cards can be made from a 52-card deck? In mathematics these are referred to as combinatorics problems. Many basic combination problems can be evaluated with the formula: The formula is verbally stated as…

## Finding Divisors And Prime Factors

Finding Divisors A divisor (D) of a number (N) is an integer that divides another integer with no remainder. In other words N mod D = 0. Sometimes, we are interested in finding all divisors of a number. If we are considering a programming solution to this problem, chances are we are dealing with very…

## Prime Number Testing

A prime number (or a prime) is defined as a positive integer greater than 1 that has no positive divisors other than 1 and itself. If I wanted a programmatic test that a number is prime, my first instinct in C# would look something like this: static bool IsPrime(int number) { for(int i = 2;…