The Collatz conjecture (also known as 3n+1 conjecture) is a conjecture that applying the following algorithm to any number we will always eventually reach one:

```
[This is writen in pseudocode]
if(number is even) number = number / 2
if(number is odd) number = 3*number + 1
```

#Task

Your task is to make a function ```hotpo``` that takes a positive ```n``` as input and returns the number of times you need to perform this algorithm to get ```n = 1```.

#Examples

```
hotpo(1) returns 0
(1 is already 1)

hotpo(5) returns 5
5 -> 16 -> 8 -> 4 -> 2 -> 1

hotpo(6) returns 8
6 -> 3 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1

hotpo(23) returns 15
23 -> 70 -> 35 -> 106 -> 53 -> 160 -> 80 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1
```

#References
- Collatz conjecture wikipedia page: https://en.wikipedia.org/wiki/Collatz_conjecture

Difficulty: introductory

Starter code:

def hotpo(n):
	

Solutions:
def hotpo(n):
    cnt = 0
    while n != 1:
        n = 3 * n + 1 if n % 2 else n / 2
        cnt += 1
    return cnt

def hotpo(num, count=0):
  return count if num == 1 else hotpo(num / 2 if num % 2 == 0 else num * 3 + 1 ,count + 1)

def hotpo(n):
    def even_odd(m):
        return [3*m+1, m/2][m%2==0]
    c = 0
    while n!=1:
        n =  even_odd(n)
        c+=1
    return c

hotpo = lambda n,c=0: c if n==1 else hotpo(n/2 if not n%2 else 3*n+1, c+1)

def hotpo(n):
    count = 0
    while n != 1:
        if n % 2:
            n = 3 * n + 1
        else:
            n /= 2
        count += 1
    return count


def hotpo(n):
    t=0
    while n>1:
        if n%2==0: n //=2
        else: n=3*n+1
        t+=1
    return t


def hotpo(n):
    x = 0
    while n > 1:
        if n % 2 == 0: n = n / 2
        else: n = n * 3 + 1
        x += 1
    return x

def hotpo(n):
    count = 0
    while n!=1:
        n = n//2 if n%2==0 else 3*n+1
        count += 1
    return count

def hotpo(n):
    iterations = 0
    while n != 1:
        if n % 2 == 0:
            n //= 2
        else:
            n = 3 * n + 1
        iterations += 1
    return iterations

def hotpo(n, i = 0):
    return i if n == 1 else hotpo(int(n / 2) if n % 2 == 0 else 3 * n + 1, i + 1)

def hotpo(n, depth=0):
  return depth if n == 1 else hotpo(3*n+1 if n%2 else n/2, depth+1)

def hotpo(n):
    count = 0
    while n != 1:
        if n % 2 == 0:
            n //= 2
        else:
            n = 3 * n + 1
        count += 1
    return count

def hotpo(n):
    if n == 1:
        return 0
    rv = 0
    while n != 1:
        rv += 1
        if n % 2 == 0:
            n /= 2
        else:
            n = 3*n + 1
    return rv

def hotpo(n: int) -> int:
    """ Get the number of times you need to perform this algorithm to get n = 1. """
    seq = []
    while n > 1:
        if not n % 2:
            n = n / 2
        else:
            n = 3 * n + 1
        seq.append(n)
    return len(seq)

hotpo=f=lambda n:n>1and-~f([n/2,3*n+1][n%2])

def hotpo(n):
    if n == 1:
        return 0
    else:
        return 1 + (hotpo(n * 3 + 1) if n % 2 else hotpo(int(n / 2)))

def hotpo(n):
    return 1 + hotpo(n//2) if n%2 == 0 else 0 if n == 1 else 1 + hotpo(3*n+1)

def hotpo(n):
    if n == 1:   return 0
    elif n%2==0: return 1 + hotpo(n//2)
    else:        return 1 + hotpo(3*n+1)

hotpo = lambda n: 1 + hotpo(int(n / 2) if n % 2 == 0 else 3 * n + 1) if n > 1 else 0

def hotpo(n):
    for i in range(999):
        if n == 1:
            return i

        if n % 2:
            n = n*3 + 1
        else:
            n = n / 2    

def hotpo(n):
    if n == 1:
        return 0
    return 1 + hotpo(n/2) if not n%2 else 2 + hotpo((n*3 + 1)/2)

# Can someone tell me if __import__ will be called each time in this case?
hotpo = __import__("functools").lru_cache(maxsize=None)(lambda n: 0 if n == 1 else 1+hotpo(3*n+1 if n&1 else n>>1))

def hotpo(n, c=0):
    return c if n == 1 else hotpo(3*n + 1 if n % 2 else n/2, c+1)

def hotpo(n, c=0):
    if n == 1: return c
    elif n%2: return hotpo(3*n+1, c+1)
    else: return hotpo(n/2, c+1)

def hotpo(n):
    if n==1: return 0
    return hotpo(3*n+1 if n%2 else n/2)+1


def hotpo(n, c = 0):
    return c if n == 1 else hotpo((n%2)*(3*n+1)+((n+1)%2)*(n//2), c+1)

def hotpo(start, memo={2: 1}):
    """ uses memoization """
    n = start
    seq_l = 0
    while n > 1:
        if memo.get(n, False):
            if n != start:
                memo[start] = memo[n] + seq_l
            return memo[n] + seq_l
        if n % 2 == 0:
            n = n // 2
            seq_l += 1
        else:
            n = (n * 3 + 1) // 2  # returns even value so -> // 2 skip's it.
            seq_l += 2
    return 0

def hotpo(n):
    x=0
    while n!=1:
        if n%2==0: n=n/2
        else: n= 3*n+1
        x+=1
    return x

#if(number is even) number = number / 2
#if(number is odd) number = 3*number + 1


def hotpo(n):
    iter=0
    while n!=1:
        if n%2==0:
            n = n/2
        elif n%2!=0:
            n = 3*n+1
        iter=iter+1
    return iter

def hotpo(n):
    counter = 0
    while n > 1:
        if n % 2:
            n = 3*n+1
        else:
            n = n//2
        counter += 1
    return counter

def hotpo(n):
    counter = 0
    while n != 1:
        n = 3 * n + 1 if n % 2 else n/2
        counter += 1
    return counter
            
    
'''
if(number is even) number = number / 2
if(number is odd) number = 3*number + 1
make a function hotpo that takes a positive n as input
and returns the number of times you need to perform this algorithm to get n = 1.

'''

def hotpo(n):
    numTimes = 0
    while n != 1:
        if n % 2 == 0:
            n = n / 2
        else:
            n = 3 * n + 1
        numTimes += 1
    return numTimes

def hotpo(n):
    count = 0
    while n != 1:
        if n % 2 == 0:
            n = n / 2
        elif n % 2 == 1:
            n = 3 * n + 1
        count += 1
    return count

def hotpo(n):
    res = 0
    while n!=1:
        res += 1
        n = n*3 + 1 if n&1 else n>>1
    return res

def hotpo(n):
    temp = [n]
    while True:
        if temp[-1] % 2 != 0:
            if temp[-1] == 1:
                return len(temp) - 1
            temp.append(3 * temp[-1] + 1)
        else:
            temp.append(temp[-1] / 2)


def hotpo(n):
    count = 0
    number = n 
    while number != 1: 
        if number % 2 == 0:
            number = number / 2
        elif number % 2 != 0:
            number = 3 * number + 1
        count += 1 
    return count

def hotpo(n):
    algorithm_move_counter = 0
    while n > 1:
        if n % 2 == 0: n = n / 2
        elif n % 2 > 0: n = (n * 3) + 1
        algorithm_move_counter += 1
    return algorithm_move_counter

def hotpo(n):
    hops = 0;
    while (n > 1):
        if n % 2:
            n = 3 * n + 1
        else:
            n /= 2
        hops += 1
    return hops

def hotpo(n):
    a = 0
    while n != 1:
        if n%2 == 0:
            n /= 2
        else:
            n = 3*n+1
        a += 1
    return a

def hotpo(n):
    res = 0
    number = n
    if number == 1:
        return res

    while number != 1:
        if number % 2 == 0:
            number = number / 2
        else:
            number = (3 * number) + 1
        res += 1
    return res

def hotpo(n):
    def __collatz(n):
        return n / 2 if n % 2 == 0 else 3 * n + 1

    count = 0
    while True:  
        if n == 1:
            return count
        
        n = __collatz(n)
        count += 1


def hotpo(n,c=0):
    if n<=1:
        return c
    else:       
        return hotpo(3*n+1,c+1) if n&1 else hotpo(n//2,c+1)

from itertools import count
def hotpo(n):
    for i in count():
        if n == 1:
            return i
        if n % 2 == 0:
            n = n/2
        else:
            n = n*3 + 1


def hotpo(n):
    if n == 1 : return 0
    count = 0
    
    while n != 1 :
        if n % 2 == 0:
            n = n / 2
        else :
            n = 3 * n + 1
        count += 1
        #print (remainder, count)
    return (count)

def hotpo(n, r=0):
    if n == 1: return r
    if n % 2: return hotpo(3*n+1, r+1)
    return hotpo(n/2, r+1)

def hotpo(n):
    count=0
    while True:
        if n < 2:
            return count
        if n%2==0:
            n /= 2
            count += 1
        else:
            n = 3*n+1
            count += 1

def hotpo(n):
    count = 0
    num = n
    if(n < 1):
        return 1
    while(num > 1):
        if(num % 2 == 0):
            num = num / 2
        else:
            num = 3 * num + 1
        count += 1
    return count


def hotpo(n):
    nums = []
    while n > 1:
        n = 3 * n + 1 if n & 1 else int(n / 2)
        nums.append(n)
    return len(nums)

def hotpo(n):
    count=0
    while n!=1:
        count+=1
        if n%2==0:
            n=n/2
        elif n%2!=0:
            n=3*n+1
    return count

def hotpo(n):
    steps = 0
    
    while n > 1:
        if n % 2 == 0:
            n = n / 2
        else:
            n = (n * 3) + 1
        
        steps = steps + 1
        
    return steps

def hotpo(n):
    if n ==1: return 0
    x=0
    while n != 1:
        if n%2==0:
            n=n/2
        else:
            n=(3*n)+1
        x+=1
    return x

def hotpo(n):
    count = 0
    while(n!=1):
        if n%2 == 0:    #is even
            n /= 2
        else:    #is odd
            n = n*3 + 1
        count+=1
    return count


def hotpo(n):
    count = 0
    while True:
        if n == 1: break
        if n%2: n = 3*n+1
        else  : n = n/2
        count += 1
        
    return count
        


def hotpo(n):
    m, s = n, 0
    while m!= 1:
        if m % 2: m = 3 * m + 1
        else: m //= 2
        s += 1
    return s


def hotpo(n):
    x = 0
    while n != 1:
        if n % 2 == 0:
            n = n / 2
            x = x + 1
        else:
            n = n*3 + 1
            x = x + 1
    return x


def hotpo(n):
    contador=0
    while n!=1:
        n=n//2 if n%2==0 else 3*n+1
        contador+=1
    return contador

def hotpo(n):
    i=0
    while n!=1:
        if n%2:
            n = 3*n+1
        else: n //= 2
        i+=1
    return i

def hotpo(n):
    
    i = 0
    j = 0
    
    if n == 1:
        j = 1
    
    while j != 1:
        
        if n % 2 == 0:
            n = n/2
            i += 1
            if n == 1:
                j = 1
                
        elif n % 2 != 0:
            n = (3 * n) + 1
            i += 1
            if n == 1:
                j = 1
        
    return i

def hotpo(n):
    cnt = 0
    while n != 1:
        cnt += 1
        if n % 2:
            n = 3 * n + 1
        else:
            n = n / 2
    return cnt

def hotpo(n, count = 0):
    if n == 1:
        return count
    n = n//2 if n % 2 == 0 else 3*n + 1
    count += 1
    return hotpo(n, count)

def hotpo(n):
    c = 0
    next_n = n
    while next_n != 1:
        if next_n % 2 == 0:
            next_n = next_n / 2
        else:
            next_n = next_n * 3 + 1
        c += 1
    else:
        return c

def hotpo(n):
    c = 0
    while n != 1:
        if n % 2 == 0:
            n /= 2
        else:
            n = (n * 3) + 1
        c+=1
    return c


def hotpo(n):
    t = 0
    while (n != 1):
        if n % 2 == 0:
            n = n / 2
        elif n % 2 == 1:
            n = 3 * n + 1
            
        t += 1
        
    return t

def hotpo(n):
    c = 0
    while n != 1:
        d, r = divmod(n, 2)
        if r is 0:
            n = d
        else:
            n = 3*n+1
        c += 1
    return c


def hotpo(n):
    c=0
    while n!=1:
        if n%2==0:
            n=n//2
            c=c+1
        else:
            n=3*n+1
            c=c+1
    return c

def hotpo(n):
    nof_times = 0
    while n != 1:
        n = 3 * n + 1 if n % 2 else n / 2
        nof_times += 1
    return nof_times

def hotpo(n):
    counter = 0
    if n != 1:
        counter += 1
        counter += hotpo(n/2 if n%2 == 0 else 3*n + 1)
    return counter

def hotpo(n):
    c = 0
    while n != 1:
        if n%2 == 0:
            n /= 2
            c += 1
        else:
            n = (n*3)+1
            c += 1
    return c


def hot(n,i):
    if n == 1:
        return i
    if n%2:
        return hot(3*n+1,i+1)
    else:
        return hot(n/2,i+1)
    
def hotpo(n):
    i=0
    return hot(n,i)


def hotpo(n):
    l=0
    while n !=1:
        if n%2:
            n = 3*n+1
        else:
            n = n//2
        l+=1
    return l

def hotpo(n):
    t = 0
    while n > 1:
        n = 3*n+1 if n % 2 else n//2
        t += 1
    return t


def hotpo(n):
    if n == 1:
        return 0
    
    count = 0
    while(n != 1):
        if n % 2 == 0 :
            n = n // 2
        else:
            n = 3 * n + 1
        count += 1
        
    return count

def hotpo(n):
    x=0
    while n>1:
        if n%2==0:
            n/=2
            x+=1
        else:
            n=3*n+1
            x+=1
    return x

def hotpo(n):
    cnt = 0
    while n != 1:
        cnt += 1
        if n % 2 == 0:
            n = n // 2
        else:
            n = 3 * n + 1
    return cnt
        


def hotpo(n):
    if n==1 : return 0
    if n%2  : return 1+hotpo(3*n+1)
    else    : return 1+hotpo(n//2)

def hotpo(zahl):
    count = 0
    while zahl > 1:
        count +=1
        if zahl % 2 == 0:
            zahl = zahl / 2
        else:
            zahl = 3 * zahl + 1
    return count

def hotpo(n):
    times = 0
    while True:
        if n == 1: break
        n = n//2 if not n%2 else n*3 + 1
        times += 1

    return times

def hotpo(n):
    res=0
    for i in range(0,500):
        if n==1:
            return res
        elif n%2==0:
            n/=2
            res+=1
        else:
            n=n*3+1
            res+=1


count = 0
def hotpo(n):
    nonlocal count
    if n == 1:
        x = count
        count = 0
        return x
    else:
        if(n % 2 == 0):
            count += 1
            return hotpo(n / 2)
        else:
            count += 1
            return hotpo(3 * n + 1)


def hotpo(n, i=0):
    return hotpo(n / 2 if n % 2 == 0 else 3 * n + 1, i+1) if n != 1 else i

def hotpo(n):
    if n%2==0 and n > 1:
        n=n//2
        return 1+hotpo(n)
    if n%2==1 and n > 1:
        n=3*n+1
        return 1+hotpo(n)
    return 0

def hotpo(n):
    i=0
    x=n
    while x!=1:
        i+=1
        if x%2==0:
            x=x/2
        else:
            x=3*x+1       
    return 0 if n==1 else i

def hotpo(n):
    
    temp = n
    time = 0
    while temp != 1:
        time += 1
        if temp%2 == 0:
            temp = temp / 2
        else:
            temp = 3* temp + 1
    return time

def hotpo(n):
    return 0 if n == 1 else 1 + hotpo(3 * n + 1 if n % 2 else n // 2)

def hotpo(n):
    collatz = 0
    while n > 1:
        if n % 2 == 0:
            n = n / 2
        else:
            n = 3 * n + 1
        collatz += 1
    return collatz

def hotpo(n):
    count = 0
    while n != 1:
        if n % 2 == 0:
            n = n / 2
            count = count + 1
        elif n % 2 != 0:
            n = 3 * n + 1
            count = count + 1
    return count

def hotpo(n):
    counter = 0
    while n != 1:
        n = (3*n) + 1 if n % 2 else n / 2
        counter += 1
    return counter

def hotpo(n):
    i = 0
    while n != 1:
        if n%2:
            n = 3*n + 1
        else:
            n /= 2
        i += 1
    return i

def hotpo(n):
    num = 0
    while n != 1:
        if n % 2:
            n = 3*n+1
        else:
            n //= 2
        num += 1
    
    return num

def hotpo(n):
    c=0
    while(n!=1):
        if(n%2==0):
            n=n/2
            c=c+1
        else:
            n=3*n+1
            c+=1
        
    return c

def hotpo(n):
    count=0
    while n>1:
        if n%2==0:
            n=int(n/2)
            count=count+1
        else:
            n=(3*n)+1
            count=count+1
    return count

def hotpo(n):
    """
    Proof? Save that stuff for happy hour!
    """
    count = 0
    while n != 1:
        n = 3*n + 1 if n % 2 else n // 2
        count += 1
    return count

def collatz(n):
    if n%2==0:
        return int(n/2)
    else:
        return 3*n+1

def hotpo(n):
    i = 0
    while n!=1:
        n = collatz(n)
        i += 1
    return i

def hotpo(n):
    nb_exec = 0
    while n != 1:
        n = n / 2 if n % 2 == 0 else 3 * n + 1
        nb_exec += 1
    return nb_exec

def hotpo(n):
    collatz_counter = 0
    while n > 1:
        if n % 2:
            n = 3 * n + 1
        else:
            n = n / 2
        collatz_counter += 1
    return collatz_counter

def hotpo(n, count=0):
  if n == 1:
    return count
  else:
    n = n/2 if is_even(n) else 3*n + 1
    count += 1
    return hotpo(n, count)

def is_even(n):
  return n % 2 == 0

def hotpo(n):
    ct = 0
    while n > 1:
        if n % 2 == 0:
            n = n / 2
        else:
            n = 3 * n + 1
        ct += 1
    return ct

def hotpo(n):
    if n <= 0:
        return 0
    count = 0
    while n != 1:
        if n % 2:
            n = n*3+1
        else:
            n //= 2
        count += 1

    return count

def hotpo(n):
    i = 0
    while n > 1:
        if n % 2:
            n = 3 * n + 1
        else:
            n //= 2
        i += 1
    return i

def hotpo(n):
    res = n
    cont =0
    while res != 1:
        res = res/2 if res%2==0 else res*3 + 1
        cont +=1
    return cont