From charlesreid1

Problem link: https://projecteuler.net/problem=14

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

Failed to parse (Conversion error. Server ("https://en.wikipedia.org/api/rest_") reported: "Cannot get mml. Server problem."): {\displaystyle n_{i+1}=3n_{i}+1}

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

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle 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.