From charlesreid1

Problem link:

The Collatz sequence, also called a hailstone sequence, is a sequence of numbers determined by two formulas, applied depending on whether the current number in the sequence is even or odd. If a given term in the sequence is odd, the next term is computed using the expression

n_{i+1} = 3 n_i + 1

and if it is even, the following formula is used:

n_{i+1} = \frac{n}{2}

Eventually, this sequence will begin to repeat. The task for this problem is to compute a Collatz sequence for all of the integers under 1 million, and determine which starting integer leads to the longest Collatz sequence.

As you can probably imagine, the integers in this problem get really big. I initially began with longs, but when I had finished the implementation and began to run the program, I realized I needed to use BigInteger in my implementation.