Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- num = int(input("N: "))
- seq = [num]
- while num != 1:
- num = num // 2 if num % 2 == 0 else num * 3 + 1
- seq.append(num)
- print(", ".join(str(num) for num in seq))
- print("Length: {}".format(len(seq)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement