Create a function which computes the Collatz Conjecture sequence for a positive integer n. The sequence is calculated as follows:
- If n is even, the next number in the sequence is n / 2
- If n is odd, the next number in the sequence is 3 * n + 1
- If n is 1, we have reached the end of the sequence (notice that once we reach 1, the sequence will end up in a loop of 1 => 4 => 2 => 1)
Now, create a second function which finds the number n with the longest Collatz sequence between 1 and positive integer i. If two numbers have the same sequence length, return the smaller of the two numbers.
- Fork this respository
- Clone it
- Solve it
- Submit pull request
To read more about the Collatz Conjecture, see the links below: https://en.wikipedia.org/wiki/Collatz_conjecture https://www.youtube.com/watch?v=5mFpVDpKX70&feature=share