def collatz(n):
while n > 1:
yield n
if n % 2 == 0:
n //= 2
collatz(n)
else:
n = (n * 3 + 1)
collatz(n)
yield n
print('Please enter a positive integer')
n = int(input())
print('Your collatz sequence:')
print(list(collatz(n)))