Checking whether the given positive number is Collatz Conjecture or not.

The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined as follows: 

  • Start with any positive integer
  • Then each term is obtained from the previous term as follows: 
    • if the previous term is even, the next term is one half the previous term.
    • If the previous term is odd, the next term is 3 times the previous term plus 1. 

    The conjecture is that no matter what value of n, the sequence will always reach 1.
    Saying Mathematically,
    Bellow is the C++ Implementation to find the number of steps in Collatz Conjecture of number less in 1 Million.

    Thank You.

    Reference : Wikipedia