csc-python-solutions/16/6 - Hailstone.py

6 lines
106 B
Python
Raw Normal View History

2021-02-17 12:01:44 +00:00
def hailstone(n):
print(n)
if n != 1:
if n%2: hailstone(3*n+1)
else: hailstone(n//2)