Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def generate_hail_seq(n):
lnum=[n]
while n!=1:
if(n%2)==0:
n=n//2
lnum.append(n)
else:
n=(n*3)+1
lnum.append(n)
return lnum
print(generate_hail_seq(10))
print(generate_hail_seq(7))
print(generate_hail_seq(8))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment