#num = int(input("Please enter a positive integer to apply Collatz algorithm: ")) limit = int(input("Check Collatz conjecture from 1 to ... ")) #num = 1 #while num <= limit: for num in range(1, limit+1): n = num while n != 1: print(n, end = " ") if n%2 == 0: n = n//2 else: n = 3*n + 1 print(1) print(num, "is OK") #num = num + 1