The Collatz sequence is as follows:
n.n divided by 2.According to the Collatz conjecture, it will always reach 1. If that's true, you can construct a finite sequence following the aforementioned method for any given integer.
Write a function that takes in an integer n and returns the highest integer in the corresponding Collatz sequence.
maxCollatz(10) ➞ 16
// Collatz sequence: 10, 5, 16, 8, 4, 2, 1
maxCollatz(32) ➞ 32
// Collatz sequence: 32, 16, 8, 4, 2, 1
maxCollatz(85) ➞ 256
// Collatz sequence: 85, 256, 128, 64, 32, 16, 8, 4, 2, 1
N/A