CSES - Shared codeLink to this code: https://cses.fi/paste/dce41542e393a739ab799/
#1
n=int(input())
print(n,end=" ")
while n!=1:
if n%2==0:
n=n//2
else:
n=n*3+1
print(n,end=" ")