algorithms.tutorialhorizon.com
Collatz Conjecture - Steps to transform Number to 1 | Algorithms
The Collatz conjecture is a conjecture in mathematics which states that no matter what value of Positive Number N, If the below sequence is followed then, the sequence will always reach 1. If N is even then do N = N/2 If N is odd then do N = 3*N+1 If N is 1 then stop else keep performing step 1 and step 2. Example: N = 7 Sequence: 7 -> 22 -> 11 -> 34 -> 17 -> 52 -> 26 -> 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 ->4 ->2 -> 1 N = 6 Sequence: 6 -> 3 -> 10 -> 5 -> 16 -> 8 ->4 ->2 -> 1