Pick a positive integer . If it is odd, multiply it by three and then add one. If is even, divide it by two. The positive integer obtained is the new , and this is repeated until the number becomes 1. Given the value of , with , determine the number of operations before becomes 1.
Sample Input
3
Sample Output
7
Explanation
will become 10, 5, 16, 8, 4, 2, then 1, which is a total of 7 operations.
Comments
Collatz Conjecture!
Someone has been watching NumberPhile!
For the full explanation:
Stop asking for help in comments.
Go to https://discord.com/invite/EgJVpxz and ask for help in the #help channel.