Lesson 3.17 3.18 blog
- Hailstone numbers
- Vocabulary
- - Collatz: The conjecture asks whether repeating two siple arithmetic operation will transform every positive integer into 1.
def collatz(i):
while i > 1:
print(i, end=' ')
if (i % 2):
# i is odd
i = 3*i + 1
else:
# i is even
i = i//2
print(1, end='')
i = int(input('Enter i: '))
print('Sequence: ', end='')
collatz(i)