Create a function called "CollatzMaxTotal" basically says: Pick any natural number n. If n is even, take n and divide by 2. If n is odd, multiply n by 3 and add 1. Repeat this algorithm and regardless of what number you picked to begin with, you will always end at 1 that given a number:
If the number is not a positive integer, generate a text that says: "The number is not a positive integer", but if it is a positive integer, generate a text that says the maximum value that the number reached with the Collatz conjecture and the number of steps it takes to get to number 1 for the first time. Example:
If the number is 7 then the function outputs: The maximum value was 52 and to get to 1 it takes 16 steps.
If the number is 9.2 then the function outputs: The number is not a positive integer
If the number is 35 then the function outputs: The maximum value was 160 and it takes 13 steps to get to 1.
Thank you
If the number is not a positive integer, generate a text that says: "The number is not a positive integer", but if it is a positive integer, generate a text that says the maximum value that the number reached with the Collatz conjecture and the number of steps it takes to get to number 1 for the first time. Example:
If the number is 7 then the function outputs: The maximum value was 52 and to get to 1 it takes 16 steps.
If the number is 9.2 then the function outputs: The number is not a positive integer
If the number is 35 then the function outputs: The maximum value was 160 and it takes 13 steps to get to 1.
Thank you