# This is the original code beginning with the number 777 and I want to show the first 37 numbers.
def Collatz(n):
i = 1
while n != 1:
print(f'{i}. {n}')
if n & 1:
n = 3 * n + 1
else:
n = n // 2
i+=1
Collatz(777)
I want it to go past and stop at the 37th number. (which probably means that the numbers are imaginary, or negative.)
2
....
Collatz = 777
i = 1
while i != 38:
print(f'{i}. {Collatz}')
if Collatz & 1:
Collatz = 3 * Collatz + 1
else:
Collatz = Collatz // 2
i+=1