Skip to content

Instantly share code, notes, and snippets.

@leod
Last active May 4, 2019 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leod/9b89af30cff21cb925d4522a68c990d7 to your computer and use it in GitHub Desktop.
Save leod/9b89af30cff21cb925d4522a68c990d7 to your computer and use it in GitHub Desktop.
def f(n):
if n == 1:
return 0
elif n % 2 == 0:
return 1 + f(n / 2)
else:
return 1 + f(3 * n + 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment